Gradients deciphered

Problems with decorations or key/mouse bindings? Or perhaps you have a cool mouse/key binding you want to share.
User avatar
morbusg
CatCoder
CatCoder
Posts: 344
Joined: Sat Jan 08, 2005 12:56 am
Location: Helsinki, Finland

Gradients deciphered

Postby morbusg » Mon Oct 24, 2005 7:13 am

I was (am?) having a hard time trying to understand the color gradients.
I *think* I got it now, but please confirm.

Here is the picture.

You can find more about it from here.

Edited by theBlackDragon:
--> Made sticky.
Last edited by morbusg on Fri Jul 20, 2007 10:41 am, edited 2 times in total.

ryo-san
Cat in the hat
Cat in the hat
Posts: 72
Joined: Fri Sep 09, 2005 7:40 am

Postby ryo-san » Mon Mar 27, 2006 11:45 pm

hi

was playing with it tonight : ).
You've got it !!! ( and helped me with your graph, thx )

bigblop
CatCoder
CatCoder
Posts: 237
Joined: Fri Apr 01, 2005 3:54 pm

Postby bigblop » Tue Jun 06, 2006 12:49 pm

Could you poste an example code. I would like to make some gradient icon for my FvwmButtons taskbar (using FvwmIconMan).

User avatar
morbusg
CatCoder
CatCoder
Posts: 344
Joined: Sat Jan 08, 2005 12:56 am
Location: Helsinki, Finland

Postby morbusg » Tue Jun 06, 2006 3:09 pm

Erm.. the picture itself is pretty self-explanatory example code
(well, apart from that it seems it depends how the last segment is interpreted based on wether there are 2, 4, 6, 8 etc. segments, or 3, 5, 7, 9 etc.)
But since you asked, this is what I'm using for my current "adapt"-theme:

Code: Select all

Colorset 2 VGradient 32 2 #e5e5dd 50 #670000 50 #e82b02

And the result looks something like this (the titlebars).
For colours, you can use either of the 2 rgb notations (rgb:rr/gg/bb, #rrggbb), or a colour name from rgb.txt.

bigblop
CatCoder
CatCoder
Posts: 237
Joined: Fri Apr 01, 2005 3:54 pm

Postby bigblop » Wed Jun 07, 2006 9:59 am

Ok this seems to work fine:


Code: Select all

Colorset 61 HGradient 32 2 #e5e5dd 50 #670000 50 #e82b02

DestroyDecor newstyle
AddToDecor   newstyle
+ TitleStyle Center Height 18
+ TitleStyle AllActive Colorset 61


But when I change the Colorset to this it does not work anymore:

Code: Select all

Colorset 61 HGradient 32 2 Red 4 Blue


I have also tried this from the manpages but it does not work either:

Code: Select all

Colorset 61 Blue Red HGradient 8 3 Blue 1000 Green 1 Yellow 1000 Red


any hints?

BTW: How did you come up with: #e5e5dd, #670000, #e82b02? In the rgb.txt file I found on my system there was no entries like that. Could be nice if it was possible to choose some colors (eg from photoshop) and then see these corresponding values.

User avatar
morbusg
CatCoder
CatCoder
Posts: 344
Joined: Sat Jan 08, 2005 12:56 am
Location: Helsinki, Finland

Postby morbusg » Wed Jun 07, 2006 11:39 am

rgb notation just means you tell the amount of each colour; red, green, blue in hexadecimal format for fvwm. Each color can be made from different values for these three colors (well to be honest, I'm not certain of that)
In rgb.txt, they are in different format, and mapped to a name. So rgb.txt has only a limited amount of colours.

It is always safe to give colours in rgb notation since one might be missing the whole rgb.txt -file (or then in some location X won't find it). You can find out the colours you want in the right format in Photoshop (or Gimp) with the colour picker; just look for a similar format (I think it's under the label of "web-colour" in Photoshop)

EDIT: Now that I think about it, I think I remember that the new 7-releases of modular X doesn't have a rgb.txt, but then again, I might remember all wrong.

thomasadam
Administrator
Administrator
Posts: 3046
Joined: Mon Nov 08, 2004 1:12 am
Location: England
Contact:

Postby thomasadam » Wed Jun 07, 2006 11:49 am

morbusg wrote:rgb notation just means you tell the amount of each colour; red, green, blue in hexadecimal format for fvwm. Each color can be made from different values for these three colors (well to be honest, I'm not certain of that)


Pretty much it can, yes. Note that the degree to which those colours is comprised depends upon how well the XServer (in this case) can manage the colours, and whether the hardware you've got can display them. The human eye can only perceive a certain colour range before it just sees the same colour.

morbusg wrote:In rgb.txt, they are in different format, and mapped to a name. So rgb.txt has only a limited amount of colours.


A little bit of history for you. X11 as a server has to cater for almost *all* kinds of colour terminals with different values. The values in rgb.txt are therefore quite generic for that reason alone. Back in the day, before PCs were some form of commodity, the *big* mainframe terminals is what X11 used to run on, with some very interesting hardware.

morbusg wrote:It is always safe to give colours in rgb notation since one might be missing the whole rgb.txt -file (or then in some location X won't find it).


If that happens, you'll run into a lot of trouble from programs that do specify colours in a named format. It won't just be FVWM that complains either.

morbusg wrote: You can find out the colours you want in the right format in Photoshop (or Gimp) with the colour picker; just look for a similar format (I think it's under the label of "web-colour" in Photoshop)


Look on freshmeat.net for 'gcolor2'.

morbusg wrote:EDIT: Now that I think about it, I think I remember that the new 7-releases of modular X doesn't have a rgb.txt, but then again, I might remember all wrong.


Absolutely not! Without rgb.txt, you wouldn't be seeing colour in half the applications you do now.

-- Thomas Adam

User avatar
morbusg
CatCoder
CatCoder
Posts: 344
Joined: Sat Jan 08, 2005 12:56 am
Location: Helsinki, Finland

Postby morbusg » Wed Jun 07, 2006 1:11 pm

Erm.. Ok..? Thanks for answering to my answer. :?

Bigblop, your non-working gradient lines are badly formed, please re-read the explaining gradient picture. Segment is the keyword here.

thomasadam
Administrator
Administrator
Posts: 3046
Joined: Mon Nov 08, 2004 1:12 am
Location: England
Contact:

Postby thomasadam » Wed Jun 07, 2006 4:29 pm

morbusg wrote:Erm.. Ok..? Thanks for answering to my answer. :?


Relax -- it's a discussion, not a picking-holes-in-answers exercise. :)

-- Thomas Adam

bigblop
CatCoder
CatCoder
Posts: 237
Joined: Fri Apr 01, 2005 3:54 pm

Postby bigblop » Wed Jun 07, 2006 6:28 pm

in you original post you say that n can be from 2 to 1000, but why is 32 not allowed?

Colorset 61 HGradient 32 2 Red 4 Blue

User avatar
morbusg
CatCoder
CatCoder
Posts: 344
Joined: Sat Jan 08, 2005 12:56 am
Location: Helsinki, Finland

Postby morbusg » Wed Jun 07, 2006 7:21 pm

bigblop wrote:in you original post you say that n can be from 2 to 1000, but why is 32 not allowed?

Colorset 61 HGradient 32 2 Red 4 Blue

And here I was, thinking that the example was clear as ice. Apparently not.

Let's try again, shall we?

If you only have two colours, you don't need to make a segment (well you do make a segment, but you don't need to define it if there's only one segment). Lets say a segment is a transform of one colour into another.

You can define a gradient in two ways:
1) If you only want one segment, you can just define the number of colours, a starting colour, and the ending colour.

2) If you want more than just two colours, you can make segments. The second "argument", then, is to define the number of segments. In the example picture, there are five segments. So the "n" is actually representing the number of colours used for the whole gradient (consisting of segments).

Would you believe all this reads in the manual page? Neither would I, it's just so amazing.

Anywhoo, after you _first_ define the number of colours, and _second_ define the number of segments, you can move on forward defining your first colour. After you've done that, you define at what percentage does it begin transforming into the colour defined after that (the beginning of segment is 0%, and the end is 100%, but for the last segment, it gets reversed if the total number of segments is pairless [this, I could very well be just making up, since I haven't tested it]). Repeat as many times as you have segments.

Confused? Me too.

I mean, why the hell did Thomas get mainframes as kid, when all the rest of us got to play with lousy commodore-whatever-they-were, playing some dull donkeykong with a wooden joystick. :D :wink:

thomasadam
Administrator
Administrator
Posts: 3046
Joined: Mon Nov 08, 2004 1:12 am
Location: England
Contact:

Postby thomasadam » Wed Jun 07, 2006 8:02 pm

morbusg wrote:I mean, why the hell did Thomas get mainframes as kid, when all the rest of us got to play with lousy commodore-whatever-they-were, playing some dull donkeykong with a wooden joystick. :D :wink:


My dad is a hydrometallurgist. His place of work during the 80s and early 90s was at a chemical plant that had a lot of cool "hardware" (at that time). They used UNIX mainframes. I remember them well, for some reason. :)

I still went through the motions with the home-PC stuff. I own and still use three BBC Master computers, as well as owning a ZX Spectrum +2 computer, with built-in tape-deck. It's cool. :)

As for the colorset thing (I don't want to completely randomise this thread with my ramblings), the gradient algorithms that are used do some very complex things -- they have to since the hue change from one colour to another is computed -- it's not stored anywhere. That's primarily why the colorset definitions have to be that specific, and whilst they might appear somewhat daunting to begin with, you're best bet (bigblop, really) is to read ''man FvwmTheme'' and the COLOR GRADIENTS section of ''man fvwm''. Of course, I don't really mean "read" as in "understand" [1] -- but more to try out the examples listed therein.

-- Thomas Adam

[1] I've never read the entire FVWM man page -- I just have the ability to memorise those parts I need to.

User avatar
Decadentgray
Kitten
Kitten
Posts: 20
Joined: Fri Sep 06, 2013 4:38 am
Location: Nuremberg / Germany

Re: Gradients deciphered

Postby Decadentgray » Sun Oct 11, 2015 3:12 pm

Ok, I'm joining the fun ;)
To be honest, I got a gradient and a question:

Code: Select all

# Border
Colorset 2 HGradient 20 #c3551a #b90882


Works like a charm, except when the window changes its size itself (rox filer). Then the existing Gradient gets tiled or cut off to fit he new window size. When I focus out and in again the border gets redrawn. Is there any way to redraw it when he window size changes?
Learning lines in the rain - Special effects by lunatic and drinks - Freeze frame, screen kiss - Hot heads, lights and power - It's patently obvious --- She's in parties - It's in the can - she's in parties - It's in the can!!

Tronar
Cat in the hat
Cat in the hat
Posts: 30
Joined: Thu Jun 05, 2014 5:58 pm
Location: Moscow

Re: Gradients deciphered

Postby Tronar » Mon Oct 12, 2015 10:36 am

You may have a look at the module FvwmEvent. It enables you to react on various kinds of WM events like iconifying windows etc.

thomasadam
Administrator
Administrator
Posts: 3046
Joined: Mon Nov 08, 2004 1:12 am
Location: England
Contact:

Re: Gradients deciphered

Postby thomasadam » Mon Oct 12, 2015 7:14 pm

No. FvwmEvent won't help you here.

User avatar
Decadentgray
Kitten
Kitten
Posts: 20
Joined: Fri Sep 06, 2013 4:38 am
Location: Nuremberg / Germany

Re: Gradients deciphered

Postby Decadentgray » Tue Oct 13, 2015 1:00 am

I haven't looked inside the fvwm source, but I assume fvwm initiates recalculating of the gradient only on user interaction.
"If there is no user interaction, there is no change, therefore nothing to do."

Sounds reasonable to me, but my beloved rox does disagree ;)
Maybe next week I'll gonna dig into it and write a patch (depending on my limited capabillitie, of course).
Or rox gets his own (gradient free) border alltogether.

But FvwmEvent sounds funky anyway ;)
Learning lines in the rain - Special effects by lunatic and drinks - Freeze frame, screen kiss - Hot heads, lights and power - It's patently obvious --- She's in parties - It's in the can - she's in parties - It's in the can!!

thomasadam
Administrator
Administrator
Posts: 3046
Joined: Mon Nov 08, 2004 1:12 am
Location: England
Contact:

Re: Gradients deciphered

Postby thomasadam » Tue Oct 13, 2015 12:01 pm

Decadentgray wrote:I haven't looked inside the fvwm source, but I assume fvwm initiates recalculating of the gradient only on user interaction.
"If there is no user interaction, there is no change, therefore nothing to do."


It redraws the gradient on ConfigureNotify changes.

Decadentgray wrote:Sounds reasonable to me, but my beloved rox does disagree ;)


Disagrees how? You need to be a lot more specific.

-- Thomas Adam

User avatar
Decadentgray
Kitten
Kitten
Posts: 20
Joined: Fri Sep 06, 2013 4:38 am
Location: Nuremberg / Germany

Re: Gradients deciphered

Postby Decadentgray » Tue Oct 13, 2015 1:01 pm

Disagrees how? You need to be a lot more specific.


Sorry, my fault ;)

When you change to another directory, rox adjusts the size of the window to fit the content of the new directory, shrinking or increasing it.
While the window border is redrawn to fit the new window size, the gradient seems to stay the same and is just tiled.

Here is an example:

http://i.imgur.com/hz3d8LD.jpg
Learning lines in the rain - Special effects by lunatic and drinks - Freeze frame, screen kiss - Hot heads, lights and power - It's patently obvious --- She's in parties - It's in the can - she's in parties - It's in the can!!


Return to “Decorations and bindings”

Who is online

Users browsing this forum: No registered users and 1 guest