It is currently Fri Sep 25, 2026 7:28 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: how to use in a script a CSS color name (solved TNX Kevin)
PostPosted: Mon Nov 24, 2014 5:40 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
GIMP Version: 2.8.14
Operating System: Windows
GIMP Experience: Beginner Level



(probably this question is addressed to Saul Goode, who helped me a few days ago)
Using the color picker interactively in Gimp I saw that it is possible to select a color based on its Css name (for instance maroon)
Is it possible to reference the CSS names of colors in an .scm script?
Is there maybe a kind of service piece of code with a list of all the equivalences such that maroon is defined as '(128 0 0)?
Or can it be directly inputed as maroon in some way?
Thanks a lot

_________________
"Where am I ?"


Last edited by dinasset on Mon Nov 24, 2014 8:44 am, edited 1 time in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: how to use in a script (.scm) a CSS color name
PostPosted: Mon Nov 24, 2014 8:08 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
(gimp-context-set-foreground "maroon")

Named colours: http://en.wikipedia.org/wiki/X11_color_names although you have to make them all lower case and remove the space characters:

(gimp-context-set-foreground "yellowgreen")

Kevin


Top
 Post subject: Re: how to use in a script (.scm) a CSS color name
PostPosted: Mon Nov 24, 2014 8:43 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
Thanks, Kevin! Very easy indeed!
I tought I tried that way, among others, before posting, but got an error (I don't remember exactly); probably I entered the name incorrectly, maybe with uppercase, I don't remember how.
Retried now and it's OK, so thanks a lot!

_________________
"Where am I ?"


Top
 Post subject: Re: how to use in a script a CSS color name (solved TNX Kevin)
PostPosted: Mon Nov 24, 2014 11:03 am  (#4) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
Hmmm. Just discovered that the "HTML notation" input field in color selectors accepts CSS color names (the one for FG/BG and also the one used for the parameters in plugins).

_________________
Image


Top
 Post subject: Re: how to use in a script a CSS color name (solved TNX Kevin)
PostPosted: Mon Nov 24, 2014 11:25 am  (#5) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
I only realised you could use colour names because I read a recent bugz from Saul: https://bugzilla.gnome.org/show_bug.cgi?id=739457

Kevin


Top
 Post subject: Re: how to use in a script a CSS color name (solved TNX Kevin)
PostPosted: Mon Nov 24, 2014 5:17 pm  (#6) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16175
paynekj wrote:
I only realised you could use colour names because I read a recent bugz from Saul: https://bugzilla.gnome.org/show_bug.cgi?id=739457

Kevin


I knew black and white worked but i had no idea you could use named colors for anything else. Good to know. :)
Thanks guys.


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group