Recent

Author Topic: Coding Color  (Read 18932 times)

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Re: Coding Color
« Reply #30 on: December 22, 2019, 04:27:55 pm »
After reading this https://forum.lazarus.freepascal.org/index.php/topic,47455.0.html?PHPSESSID=iglt7vrjm7gcgajak3lshho3l4

I decided to toying around some color scheme

Today I should care for my eyes, using night mode monitor and blue light glasses seem not enough.

I am not color expert, but this references are usefull

https://ethanschoonover.com/solarized/
https://jfly.uni-koeln.de/color/
https://www.color-blindness.com/coblis-color-blindness-simulator/


Using Fira Code Font https://github.com/tonsky/FiraCode

for half screen got 120 column and about 50 row at 9 Editor font size 2 Extra line spacing
but ligatures only work on comment block

for user defined markup, I add list Noise with item _ and ;
Foreground color set to #586E75 with alpha 200,
still need adjustment, dont have the right color yet.

I use italic only for directive to distiguish it from comment, for old style comment seem make sense today

(*
    json := { "key" : "value", "ok" : true }   more curly braces

    ls -l | less    | vs /  in italic ???
*)

Here it is, a dejavu with TP6

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6675
  • Debugger - SynEdit - and more
    • wiki

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Re: Coding Color
« Reply #32 on: December 24, 2019, 07:01:49 am »
@Martin_fr

Yes I have read it in the post, and try "Solarized2 day version" for testing.

strange thing for ligatures, currently working now, but I feel loose connection between what I read and what I type.

I am curious about margin width, and I tested for 120 on a paper, and look like below 8 point is too small.

Back then when I was newbie, I like using 132 condensed dot matrix font,
because I am using a lot space, one space between braces () [], tab 3 size, and a lot lot if statement  :D

I wonder what are lines between 80 and 120, so I made a simple program.

The result from svn (*.pas, *.pp, *.inc)

Total File : 15944
Total Line : 6001723 % : 100.00
Total  80  : 5385170 % :  89.73
Total 100  : 420548 % : 7.01     ???
Total 120  : 77719 % : 1.29      ???
Total GT   : 118286 % : 1.97

Not sure for now for that 8%, but may be I should create another topic.




Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6675
  • Debugger - SynEdit - and more
    • wiki
Re: Coding Color
« Reply #33 on: December 24, 2019, 12:56:00 pm »
I haven't tested that font.....

strange thing for ligatures, currently working now, but I feel loose connection between what I read and what I type.

I haven't tested the font, but ligatures may fail...
Ligatures do not change what SynEdit sees. It just changes the Glyph that is painted. SynEdit will be completely in the dark about it.

1) SynEdit enforces monospaced. So a ligature for ">=", must have the same width as 2 chars. (When printing black and white on paper, you may get away with less space.)
2) When you select text, and half of the >= is selected (one char is, the other is not) then the chars will display individually, because SynEdit paints them separately.

Whenever the color (including bold, italic, underline, frame, ...) of text changes in a line, SynEdit will calculate where a strict monospaced font would be at that time (e.g. 5 char = 4*x // 4 chars of width x before).
If the font did not output the first 4 chars according to that rule, then it gets ugly.


Quote
Back then when I was newbie, I like using 132 condensed dot matrix font,
because I am using a lot space, one space between braces () [], tab 3 size, and a lot lot if statement  :D
You can set the "Extra character spacing" (Tools > Options > Editor > Display) to a negative value.... But it will get hard to read.

If you want to print sources, you can export as HTML. That will keep colors, and a html viewer probably can wrap the lines before printing.
The current abilities to print sources from the IDE are unfortunately rather limited.

About your statistics: I have often seen comments to go past the 80 char border. But sometimes regular sources do to.
The 80 char rule originated in the early days, when graphic cards had a textmode with 80x25 chars on the screen (in the days of dos).

lucamar

  • Hero Member
  • *****
  • Posts: 3083
Re: Coding Color
« Reply #34 on: December 24, 2019, 01:20:35 pm »
The 80 char rule originated in the early days, when graphic cards had a textmode with 80x25 chars on the screen (in the days of dos).

Rather earlier, I think: wasn't it the line-length of  punch-cards and teletypes? I kind of remember COBOL and Fortran coding-sheets having that line-lenght ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

MarkMLl

  • Hero Member
  • *****
  • Posts: 1371
Re: Coding Color
« Reply #35 on: December 24, 2019, 01:28:42 pm »
About your statistics: I have often seen comments to go past the 80 char border. But sometimes regular sources do to.
The 80 char rule originated in the early days, when graphic cards had a textmode with 80x25 chars on the screen (in the days of dos).

I've never seen any firm recommendation regarding line length in standards documents.

The only thing I have seen is a "MUST" in one of the original RFCs limiting email lines to 78 chars (plus the mandatory CR LF making 80), presumably in case protocol converters mandated a maximum length or mainframe-based store-and-forward used files derived from punched card images.

I wonder what's reasonable these days: a 1200-pixel width with 8+1 character width which magically comes out to 133 chars? :-)

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

lucamar

  • Hero Member
  • *****
  • Posts: 3083
Re: Coding Color
« Reply #36 on: December 24, 2019, 02:46:48 pm »
I've never seen any firm recommendation regarding line length in standards documents.

For normal-sized paper the maximum lenght is still around 80 characters, which corresponds (roughly for monospaced fonts) to the old 10 CPI (aprox. a 12pt font) on an 11' wide sheet (or 210mm. A4 sheet)

Quote
I wonder what's reasonable these days: a 1200-pixel width with 8+1 character width which magically comes out to 133 chars? :-)

It may sound strange but except on very big monitors I still find 80 to 90 characters max. the best width. The nowadays "standard" 128 chars. are way too small on a normal 15" or 17" one. YMMV, of course; it's always a subjective issue and in my case (and most people of my generation) it's compounded by having bad-sight, due probably to having spent almost my whole life in front of a monitor :)

What I've found is that if you get a bigger monitor, it almost always ends up placed farther (to be able to see most of it in your visual field), so the size/resolution gain is counterchecked by the increased distance.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Re: Coding Color
« Reply #37 on: December 27, 2019, 05:26:56 am »
@Martin_fr,  it works  :D


I like coding with a book and paper as a reference, a hardcopy,
in today become much more use of softcopy (ebook, chm, pdf, webbrowser, notepad, and writer).

Pair in my monitor left side my code editor, and my right side is my softcopy.
I like non docking Lazarus IDE, so I can pair with lhelp.

For the 8%, here the sample file

fpc/packages/fcl-passrc/src/pasresolver.pp -> a single line comment, parameter list
fpc/packages/googleapi/src/googlecompute.pp -> identifier
fpc/packages/googleapi/src/googledfareporting.pp -> identifier too long
fpc/packages/odata/src/sharepoint.pp -> identifier too long
fpc/rtl/android/jvm/androidr14.inc -> class name and property
fpc/rtl/java/jdk15.inc -> name = value alignment
fpc/packages/rtl-unicode/src/collations/collation_zh_le.inc -> const look like spreadsheet

120 just because of this?

  TMicrosoft_SharePoint_Marketplace_CorporateCuratedGallerySPCorporateCuratedGallerySettingsBase = class;
  TMicrosoft_SharePoint_Marketplace_CorporateCuratedGallerySPCorporateCuratedGallerySettingsBaseArray = Array of TMicrosoft_SharePoint_Marketplace_CorporateCuratedGallerySPCorporateCuratedGallerySettingsBase;
  TMicrosoft_SharePoint_Marketplace_CorporateCuratedGallerySPCorporateCuratedGallerySettingsFactory = class;
  TMicrosoft_SharePoint_Marketplace_CorporateCuratedGallerySPCorporateCuratedGallerySettingsFactoryArray = Array of TMicrosoft_SharePoint_Marketplace_CorporateCuratedGallerySPCorporateCuratedGallerySettingsFactory;
 
For good advice https://wiki.freepascal.org/Identifier

I check this font https://typeof.net/Iosevka/ can be fit for 120 at 8 on A4 paper
Also try DejaVu Sans Mono 10 on A4 landscape

after some die trying, the rigth side full of more space.

@lucamar yes! I am very agree, 80 margin still the best option.

At least you have Full HD resolution for screen, but in 13" - 15" for me still look so small.
Also if using 7" tablet, A4 dont look good, maybe A5 80 column using Iosevka 9.
Still can for full screen on 13", but I would rather scroll vertically.

My current path is choose to formatting code
1. aligment of parameter
2. constant string, string resouce
3. property

May be it can reduce from 8% to 1%, with consequence of more line.

And No!, for LOC. http://wiki.c2.com/?LinesOfCode

del

  • Full Member
  • ***
  • Posts: 185
Re: Coding Color
« Reply #38 on: January 12, 2020, 05:01:22 am »
IDE theme is ObjectPascal - Default, but editor has custom syntax highlighting with a pure black background. Font is Linux "Monospace". Comments and whitespace symbols are "dimmed". And the config is backed up. I've had problems with Dark IDE themes  before - not necessarily with Lazarus - so I usually go with default, and just modify the syntax highlighting.

 

TinyPortal © 2005-2018