Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

What color scheme do you prefer for scripts in the forum?


  • Please log in to reply
43 replies to this topic

Poll: Which color scheme do you prefer for scripts? (see below for visual examples) (25 member(s) have cast votes)

Which color scheme do you prefer for scripts? (see below for visual examples)

  1. I like it the way it was: green for the entire script. (0 votes [0.00%])

    Percentage of vote: 0.00%

  2. It doesn't matter to me much as long as it's legible. (2 votes [8.00%])

    Percentage of vote: 8.00%

  3. Medium blue with green (its blue is RGB #0000C0) (this is the current setting). (8 votes [32.00%])

    Percentage of vote: 32.00%

  4. Bright blue with green (its blue is RGB #0000FF). (2 votes [8.00%])

    Percentage of vote: 8.00%

  5. Dark blue with green (its blue is RGB #000080). (9 votes [36.00%])

    Percentage of vote: 36.00%

  6. Blue for text but make the comments gray instead of green. (3 votes [12.00%])

    Percentage of vote: 12.00%

  7. Some other color scheme (please describe it). (1 votes [4.00%])

    Percentage of vote: 4.00%

Vote Guests cannot vote
holomind
  • Members
  • 341 posts
  • Last active: Aug 23 2015 03:27 PM
  • Joined: 11 Mar 2006

And I agree, even simple comment coloring takes some time on modern computers, and last forever on older ones... Plus the JS file will get very big, and doing proper highlighting of AutoHotkey isn't as easy as it sound (certainly not with just a bunch of regexes).


i have a great idea, i could convert the the javascript code into a bookmarklet and then a user can apply colorformating on demand.
simply click on a bookmark in your browser and apply colors.
so the js for highlighting is not called automatically but on userrequest. and everybody can have its own bookmarklet and even customize the color inside it.
http://www.bookmarklets.com/
i know how to convert the js into a bookmarklet. then you can keep it old-style with old browsers and apply syntax-highlighting if you like with the click of your bookmarklet, turning all code blocks in a page into color-code.
as a user applys the bookmarklet, there is no "global" colorscheme and no discussion about green or gray. simply use the "green.bookmarklet" or "grey.bookmarklet" or the "10 colors bookmarklet" ;) changing the code from the (textarea) into the current bb-html code (code+pre) is easy.
using document.getElementById should also be very crossbrowser compatible. (only some old browsers would not work, but they are too slow for colorhighlight anyways)

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Hey, I even contributed work to a syntax coloring editor, so I cannot agree more...
Another problem with full syntax coloring is that in most cases I saw, styles are hard-coded. At best, they are in a CSS, so I can change them if I want, with a user stylesheet (not a solution for everybody), or at worse, like I saw at the official Java forum, they are hardcoded with font tags!
And doing an easy interface to allow user to fully change all styles is heavy-weight (on the programmer side).

And detecting a function isn't so trivial in AHK, because there is no associated keyword. There have been discussions on the topic (find functions definitions with regexes) already.
But perhaps I focus too much on what AutoHotkey allows (MsgBox => Foo is an assignment) rather than on the most common uses.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

holomind
  • Members
  • 341 posts
  • Last active: Aug 23 2015 03:27 PM
  • Joined: 11 Mar 2006

Hey, I even contributed work to a syntax coloring editor, so I cannot agree more...

ok, lets agree colors are good ;)

Another problem with full syntax coloring is that in most cases I saw, styles are hard-coded.

hmm, in this system there is a kind of css class applied to a span/section of text. and the .css tells it what it should look like in terms of color. you even can turn of color-highlighting by only changing the .css file and apply no or only black color to all types (keyword,string etc.)

At best, they are in a CSS, so I can change them if I want, with a user stylesheet (not a solution for everybody)

i wote for this. and would be the natural way if one does reuse of the phpbb. php-highlight-mod and the js from my post.

, or at worse, like I saw at the official Java forum, they are hardcoded with font tags!

fonts are dead, dont even think about it.

And doing an easy interface to allow user to fully change all styles is heavy-weight (on the programmer side).

why ? its already built into phpbb (even this version). you have a variable for "bbstyle" in your profile already. click on your profile-link.
...
Board Style:
...
or one adds a new field called "code-syntax-style"
this sould also switch the css-file for you. the solution with cookie might be easier as it does not interfere with the phpbb code. and is used like an "overlay"-function.

And detecting a function isn't so trivial in AHK, because there is no associated keyword. There have been discussions on the topic (find functions definitions with regexes) already.

ooh, i will look into this topic, but cant understand why it should not work.
isnt a function defined by SOMEWORD { ... } ? Some userdefined word followed by brackets, or even with SOMEWORD(..,..) {...} which makes it even easier to detect because of the ()-brackets.
if someword is a ahk-keyword already like "If" or "loop" this will be matched already by the keywordlist and not detected false. as i said. having returns and spaces between somword and { is no problem in regex. also the problem with ; inside a "string" is not so hard by applying different regex and one with high prio matches. its not trivial but not that hard.

But perhaps I focus too much on what AutoHotkey allows (MsgBox => Foo is an assignment) rather than on the most common uses.

can you give a short example or a link to the documentation so i can understand what you mean with "msgbox => foo" ?

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
To clarify: by "easy interface to allow user to fully change all styles" I mean letting the user change the attributes (family, weight, slant, colors) for each different style (keyword, comment, string...).

On the function regex, I save you some search: http://www.autohotke...pic.php?t=12788
Indeed, a regex can take care of 99.9% cases/scripts, I always worry for the special legal cases...

About MsgBox => Foo, it is something that bite me, it isn't in the manual (AFAIK). Just run this, you will be surprised... :-)
I gave some syntax pitfalls in another topic: http://www.autohotke...pic.php?t=10378
Again, lot of contrived code, but the MsgBox really happened for me and I would have been happy to have the coloring showing the problem... Good coloring should point out the differences between a = b and a := b or If (a = B) and If a = b, two common pitfalls for beginners.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

holomind
  • Members
  • 341 posts
  • Last active: Aug 23 2015 03:27 PM
  • Joined: 11 Mar 2006

To clarify: by "easy interface to allow user to fully change all styles" I mean letting the user change the attributes (family, weight, slant, colors) for each different style (keyword, comment, string...).

i meant only switching between preconfigured colorschemes, not to set each color separate. i will follow my bookmarklet idea perhaps with a little "bookmarklet generator-form" like they have for customizing for a searchengine on bookmarklet.com. and the user stores the bookmarklet locally.

Indeed, a regex can take care of 99.9% cases/scripts, I always worry for the special legal cases...

99% would be enough, i think even editplus highlighting is not 100% correct.

About MsgBox => Foo, it is something that bite me, it isn't in the manual (AFAIK). Just run this, you will be surprised... :-)

ok, this is a very odd syntax and i would just highlight it as it were
MsgBox := "> Foo"
and add a note to documentation that "=>" has a special meaning like := is different from = .

I gave some syntax pitfalls in another topic: http://www.autohotke...pic.php?t=10378
Again, lot of contrived code, but the MsgBox really happened for me and I would have been happy to have the coloring showing the problem... Good coloring should point out the differences between a = b and a := b or If (a = B) and If a = b, two common pitfalls for beginners.


i read all the posts, but there is little regex in there. (only one for matching function calls)
for me its no problem that the highlight for the function-definition and the function-call looks like the same, you easily see through the context if its definition or calling. you should add some comments behind your call to clarify its meaning. It its not the fault of ahk to be short (chris explained why he skipped def, func etc.) , its your fault not understaning your own code, so you should document it ;) i never run into trouble with it. i look at an ahk-example how to do it, modifiy it and it works...

there is a big discussion about := vs. = , i personally also made errors with the difference in the beginning. Having more examples / details in the documentation or tutorial would have been enough for me to prevent this errors, i had to write some scripts to learn how it works. it should be on of the first things to learn in ahk for beginnerst before diving into commandllist. i think the tutorial should be optimized and the beginners redirected to the rtfm a lot ;)

both are useful. but i like the := much more as its always clear whats going on and you save a lot of %-chars. i even like the syntax
tooltip, %[space] now code is like :=...
its a bit confusing in the beginning but very useful, i guess its better to have a good documentation , tutorial and examples and keep the syntax like it is. you can simply "not use" = without := without problems.

also the if x vs. if (x) , comming from php i always have brackets, or only skip them if i hav something like " if !active_that " but i prefer using brackets. in php you also can skipp the {block}-brackets but its a good codestyle to write them as you prevent many bugs. its not really hard to write them. in my 100 lines ahk -scripts the {}-brackes are less than 5% of chars, e.g. no problem in "saving" code. consistency in reading and then writing less bugs is more important.

i also always indent my code in functions and also always add a fake function/label "main:" so i get nicely formated code.

#env...

Main: 
    ;workflow to do, func. names nearly replace need for documentation
    Gosub, ReadConfig
    Gosub, DoX
    Gosub, DoY
Return 

ReadConfig:
...

i also now always register hotkeys with
   Hotkey, F10 , Gosub xy
   Hotkey, F11 , Gosub yz

  ; instead of
   F10::
   xy:
      ;;;
   return 

as the code is much easier to config / maintain if you have a list of all registered hotkeys at the beginning and not spread all over your code (where you save some tiny chars/bytes) .
when i compare programming with ahk compared to c# i already saved 1,99GB of space this gives me enough savings for a lifetime, also you normally write much more chars in the comment as you ever could save by skipping brackets. (if you dont like brackets than you should do python and not ahk ;)

the syntaxhighlighter on the forum does not have to be as detailed as the code-editor which you use for coding and here color means "finding bugs". in forum it means "easier to read". i have very little syntax errors in writing ahk, so i like the syntax like it is. my only problem was ";" without space at line-end as used in php or cpp, but i get used to it.
and if something does not work, i look a bit deeper into documentation and learn many more useful features of ahk (which i would not find if it worked in the first place).

holomind
  • Members
  • 341 posts
  • Last active: Aug 23 2015 03:27 PM
  • Joined: 11 Mar 2006

Unless a comprehensive syntax highlighter for AutoHotkey commands, keywords, variables, symbols and expressions is implemented (which isn't practical),


this post is old, but why is it not practial? its easy to do, also the command-list and keywords could be extracted from the ahk.cpp sourcecode with grep-commands or a little script automatically.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

my modified version to display AHK-Code in color (within [ code ]-section of this forum, not my editor!)

I tried it in Firefox (MSIE wouldn't load it, even after "allowing blocked content"). Although it's a bit more colorful than my tastes, it's very impressive!

it uses a textarea to start with it should fallback nicely to old browsers with weak js-support.

I like the idea of a textarea, at least for very long scripts. It avoids the need to scroll down so far to find where the non-code sections resume.

Getting the browser to remember your settings...is easy as pie!...

javascript:document.cookie="ahk_comm-single=color: gray[color=blue];expires=1-19-19 7:19:19pm[/color]";document.cookie="ahk_comm-multi=color: gray[color=blue];expires=1-19-19 7:19:19pm[/color]";void(0)

Thanks!

holomind, if you follow the other topic, you will see that Chris isn't hot to do full syntax highlighting in JS... And I agree, even simple comment coloring takes some time on modern computers, and last forever on older ones... Plus the JS file will get very big, and doing proper highlighting of AutoHotkey isn't as easy as it sound (certainly not with just a bunch of regexes).

That's a good point. Although JavaScript highlighting has many advantages, it also has some drawbacks such as the one mentioned above, and occasional delays in taking effect caused by any slow-loading images on the page.

Thanks.

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012

this post is old, but why is it not practial? its easy to do, also the command-list and keywords could be extracted from the ahk.cpp sourcecode with grep-commands or a little script automatically.

All the definitions in the syntax files (\AutoHotkey\Extras\Editors\Syntax) come up to 12KiB. Including them in a javascript parser similar to the existing one for comments would cause an increase in page load time and require a lot of memory. As a result, slow computers may crash if a very large document is being modified - this includes many pages in the scripts and functions section.

Ultimately it's for Chris to decide. I suspect that he'll say something about waiting until phpBB 3 is released but if not, writing up another javascript would be no problem at all.

holomind
  • Members
  • 341 posts
  • Last active: Aug 23 2015 03:27 PM
  • Joined: 11 Mar 2006
@titan: this one uses a keywordlist already (12kb? only the keywords, hmm)

http://www.dreamproj...taxhighlighter/

its not superfast, but looks great, if used in a bookmarklet and not autoloaded, one can decide for each script if color would be useful.
and apply colors on demand.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Yes, my biggest reluctance with making more changes to the forum is the burden of testing. If someone wants to take on that burden in addition to the development, that would help a lot. On the other hand, I wouldn't blame anyone for being reluctant to do all of that.

Another small issue with syntax highlighting on the forum is that not everyone likes it (except for the comments, which I think most people agree are great to have in a separate color). I'm sort of like this myself, possibly because I've seen too many highlighters that go to the extreme of having 4 or more different colors, which I find distracting.

Although the forum is a great benefit to AutoHotkey users, it could be an even larger benefit to implement strong syntax highlighting and utility integration (such as Intellisense) in a free editor and make it the recommended editor -- possibly even distributing it with AutoHotkey or providing a means to auto-download it from the installer. It's likely that 80% of users do not know that syntax highlighting exists for AutoHotkey -- or even if they do, they're hesitant to make the effort to install it (believing it to be complicated).

The only serious candidates I know of are PhiLho's work on SciTE and Toralf's work on PSPad. Since the benefit seems huge, it would be great if someone would volunteer someday to do a more complete integration of AutoHotkey with one of these free editors.

We have a lot of talent here and it would be great if it can be put to better use on things that provide the biggest benefit to the largest number of people.

holomind
  • Members
  • 341 posts
  • Last active: Aug 23 2015 03:27 PM
  • Joined: 11 Mar 2006

... it could be an even larger benefit to implement strong syntax highlighting and utility integration (such as Intellisense) in a free editor and make it the recommended editor -- possibly even distributing it with AutoHotkey or providing a means to auto-download it from the installer. It's likely that 80% of users do not know that syntax highlighting exists for AutoHotkey -- or even if they do, they're hesitant to make the effort to install it (believing it to be complicated).

you mean something similar to this idea. a ide which is included in the downloadfile already
http://www.purebasic.com/index.php3 (they have a trial version, so you can see what your competitor are doing ;)

purebasic editor written in purebasic. or ahk-editor written in ahk.
http://www.purebasic...hots/Editor.png
=> scite + isense script

http://www.purebasic...ualDesigner.png
=> gui-creator script

they even have a debugger, but i like ahk more, its a different concept and lets you do more things and easiert (through hotkeys) than purebasic.

but they have 3d-integration, which is nice. (eg. for a opengl-version of expose-clone ;) the 3d engine is not purebasic, but only includes/interfaced with the opensource- ogre library. (they say ogre is so good, the didnt even try build their own purebasic-3d engine ;)

perhaps ahk website also needs some attractive screenshots and "what cannot be done with ahk" page. more like a monthly Top10 to attract more users.
purebasic is also very efficient even parts written in assembler , but ahk is better ;)

JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004

sure grey ;)

...gray...

...but did you realize there are more colors than blue and gray.

...yes, there's JSLurple...but we were just discussing minimal changes, your post was the 1st to suggest such a wild (& with some changes nice) idea...for the forum...I know good syntax highlighters exist, but not for the FORUM too...cool. But I don't like all the colors in your (small) screenshot on page 2. I also don't indent subroutines...I do on functions & most stuff, but not subs...

OMG holomind!!! DON'T POST BIG PIX!!!...make a small thumbnail & link to the biggie.

I thought the dates should be in GMT format, something looking like "expires=Sun, 01 Apr 1900 01:23:45 GMT".

...nope you don't need to follow the pack...stand out!...GMT sucks!

What is your format...

...a good one...it's m-d-yy h:mm:sstt...tho I normally specify EST like...

javascript:document.cookie="ahk_comm-single=color: gray[color=blue];expires=1-19-19 7:19:19pm EST[/color]";document.cookie="ahk_comm-multi=color: gray[color=blue];expires=1-19-19 7:19:19pm EST[/color]";void(0)
...but I thought of that after people had responded...if I don't specify EST the time 7:19:19pm is actually shifted to GMT as the REAL expiration date...annoying...

...and is it accepted by all browsers?

...I have no idea, I just use it & it works for me...I don't care about being compatible with comps/browsers I don't have...tho you will probably need a 4-digit year...but otherwise I think my format works...

Anyway, I will use the JS toGMTString() function, so the format will be always OK.

...GMT sucks...

:evil: WAR ON HORIZ SCROLLING!!! :evil:
Useful forum links: New content since: Last visitPast weekPast 2 weeks (links will show YOUR posts, not mine)

OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...

Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".

I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)
How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

sure grey ;)

...gray...


Grey!
...
kWo4Lk1.png

concerned
  • Guests
  • Last active:
  • Joined: --

Chris, both Medium blue and Dark blue look exactly the same now or is it just me?


Yeah, me too. I do like the different color for comments as posted buy jballi in an earlier post (even without the italics).

Otherwise, of the color schemes in the original post, I like the "Brightest blue (RGB #0000FF)".

I am slightly red - green color blind (as are many males), which may explain why some other have commented that they cannot see the differences between Medium blue and Dark blue.

On the other hand, I can live with the current color settings.