is there a plugin in Geany capable of highlighting codes to display HEX and RGB colors with an appropriate marker? or is it possible to do this in the config syntax highlighting?
or is it possible to do this in the config syntax highlighting?
Not in Geany, the lexical entities are recognised by the lexer in the [lexilla library](https://github.com/ScintillaOrg/lexilla/blob/master/lexers/LexCSS.cxx) which does not appear to identify colour values differently to other values.
Supposing *someone* wanted to write a plugin to do what you want... What do you mean by:
... with an appropriate marker...
If you want to check the color of a value, Geany has a color chooser. There is also a "Send Selection to" command. There might be an external program that could display the colors you send it.
@xiota a plugin would have to use one of the Scintilla facilities not used by Geany/Lexilla for styling since it will simply be overwritten by the lexer if the plugin uses any of those, eg colour, font face, etc.
Some indicators (some are used by Geany for compiler errors, but that does not apply to CSS) or annotations are available for plugins (assuming they are not used by other plugins enabled at the same time).
@elextr Doesn't that depend on what "appropriate marker" means? A "marker" could be *anything*.
Would displaying a tooltip to show the color when the mouse hovers over a hex code (if it's possible) conflict with anything?
To make the conclusion I'm trying to convey clearer, no it can't be __anything__!!!
It can't be anything that Geany/Lexilla/another plugin uses, like changing the text colour to match the value, that would need a lot of styles since each colour would need its own, and a large CSS might run you out of styles (max 255 less already used). But also Geany and the lexer will simply re-write the style when its re-run on that piece of text.
If no build errors are used by the filetype [Indicators](https://www.scintilla.org/ScintillaDoc.html#Indicators) are available AFAIK, and [annotations](https://www.scintilla.org/ScintillaDoc.html#Annotations) are not used anywhere so thats what the OP has to choose from.
My question is for clarification about what OP means by "appropriate marker". It's not clear what qualifies as a "marker" to OP, except *maybe* that it "display HEX and RGB colors".
How important is the "highlighting" part? Maybe not at all, if the primary purpose is to show the color that's represented. But if highlighting is the primary purpose, numbers, including hex values, are already highlighted, and the secondary purpose of showing colors may not be possible.
But if showing the color is the primary purpose, a tooltip could accomplish that without changing any Scintilla or Geany styles. The plugin would just need to extract the hex code and screen location. Then it could use GTK to display the color independently of scintilla when the mouse cursor is the right position.
Almost all types of values including colours are one lexical entity type, so they all show the same, colours
Of course if the "anything" is a display separate from the Scintilla widget thats ok, although I'm not sure if Scintilla widget allows tooltips.
The sort of thing other IDEs do [is](https://code.visualstudio.com/docs/languages/css#_syntax-coloring-color-prev...) and is likely what the OP is thinking of if given a choice of "anything" :grin:, but thats the sort of thing that can only be done if its built into the Lexilla lexer which isn't Geany's code.
[Late edit: Although I just found indicators can have any [colour](https://www.scintilla.org/ScintillaDoc.html#SCI_INDICSETFLAGS), (I mean why would anyone not notice that SETFLAGS sets colour from the name? :grin:), so maybe something similarish to VS code is actually possible with a Geany plugin if somebody wants to try it.]
The sort of thing other IDEs do...
That looks terrible. If it's ever introduced to Geany, I will promptly open a PR to add an option to disable it.
I will promptly open a PR to add an option to disable it.
I doubt it will be added to the Lexer without an option that you can disable, and that can go in your filetypes.css, but if it slips past Neil you can always PR Lexilla, its now in github.
If its a plugin, well the advantage of plugins is you don't need to load them :)
Although I just found indicators can have any colour, (I mean why would anyone not notice from the name that SETFLAGS sets colour? grin), so maybe something similarish to VS code is actually possible with a Geany plugin if somebody wants to try it.
That might even be doable with a Lua script since the GeanyLua plugin can send scintilla messages.
If its a plugin, well the advantage of plugins is you don't need to load them :)
I'm seeing why you seem to push some feature requests toward plugins...
Mentioning `add-ons` on https://github.com/geany/geany/pull/2972 caused me to look at it, there is an option to make a coloured tooltip appear over some things that look like hex colour specs. (See what I mean by its a "catch all", its easy to miss things.) The capability is not CSS specific so it doesn't understand names or rgb() AFAICT but it make be sufficient for @82d or somebody could improve it.
Mentioning add-ons on geany/geany#2972 caused me to look at it, there is an option to make a coloured tooltip appear over some things that look like hex colour specs.
I don't understand most of the options in the addons plugin... but I also noticed them after you mentioned it. In case anyone has trouble finding them, they are:
* Show a calltip when hovering over a color value * Open Color Chooser when double-clicking a color value
I beg your pardon for delaying the answer. there was a lot of work. the essence of the question is to display all the colors at once, and not when seeing. I want it to be like this [plugin](https://github.com/ap/vim-css-color) does.
Mentioning `add-ons` on [geany/geany#2972](https://github.com/geany/geany/pull/2972) caused me to look at it, there is an option to make a coloured tooltip appear over some things that look like hex colour specs. (See what I mean by its a "catch all", its easy to miss things.) The capability is not CSS specific so it doesn't understand names or rgb() AFAICT but it may be sufficient for @82d or somebody could improve it.
I beg your pardon for delaying the answer. there was a lot of work. the essence of the question is to display all the colors at once, and not when seeing. I want it to be like this [plugin](https://github.com/ap/vim-css-color) does.
The Vim plugin seems to display the background as the specified colour. Normal styling in Scintilla allows for only 255 styles, so thats not enough so AFAICT that may not be possible without Scintilla additions since it can only specify foreground (ie the text) colours with RGB for indicators, see [here](https://www.scintilla.org/ScintillaDoc.html#SCI_INDICSETFLAGS). Then a suitable Geany plugin could do it.
Scintilla is the editing widget, it is a separate project and any changes would have to be made there first.
github-comments@lists.geany.org