Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Color Themes and Icon Sets

Reply
 
Thread Tools Display Modes
Old 07-04-2022, 03:23 AM   #1
frenchkissaudio
Human being with feelings
 
Join Date: Jun 2022
Posts: 5
Default Help me understand how color values are encoded in the .ReaperTheme file

I would like to edit my theme's color values directly in the .ReaperTheme file using a text editor instead of using the Theme development/tweaker, but I do not understand what kind of encoding is used to represent the colors. I do not think it's RGB(A) or HSV(A) or HEX. It's digits only, but I couldn't deduce a pattern. Any ideas?
frenchkissaudio is offline   Reply With Quote
Old 07-04-2022, 04:16 AM   #2
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,812
Default

RGBA in decimal, little endian. Convert the number to hex and reverse the bytes for a familiar #rrggbbaa representation.
schwa is offline   Reply With Quote
Old 07-04-2022, 04:38 AM   #3
frenchkissaudio
Human being with feelings
 
Join Date: Jun 2022
Posts: 5
Default

schwa, thank you. I am not familiar with little endian, but you've given me enough info to dig deeper.

Last edited by frenchkissaudio; 07-04-2022 at 06:12 AM.
frenchkissaudio is offline   Reply With Quote
Old 07-04-2022, 10:34 AM   #4
frenchkissaudio
Human being with feelings
 
Join Date: Jun 2022
Posts: 5
Default

Do I understand correctly that alpha values are ignored by a UI element unless that element also has a separate _mode parameter (ex: mute_overlay_mode=196608) specified alongside its color parameter (ex: mute_overlay_col=2566914303)?
frenchkissaudio is offline   Reply With Quote
Old 07-04-2022, 10:34 AM   #5
frenchkissaudio
Human being with feelings
 
Join Date: Jun 2022
Posts: 5
Default

Also, I noticed that converting mute_overlay_mode=196608 decimal value to hexadecimal gives the 5-digit number 30000, which in this case is equal to the alpha of 1.00.

Converting mute_overlay_mode=131072 decimal value to hexadecimal gives the 5-digit number 20000, which in this case is equal to the alpha of 0.00.

I cannot figure out how these 5-digit hex values relate to alpha values. Do they deal with alpha only or do they also encode the blend mode?

I am way in over my head, but it's fun!

EDIT: After some messing about it looks like setting the value of mute_overlay_mode in .ReaperTheme to 196608 or 131072 does not affect the blend mode and only changes the alpha value.

I can see this by keeping the Theme development/tweaker open and refreshing the theme after changing the values in .ReaperTheme. The Theme development/tweaker reads the new values from .ReaperTheme which is handy for understanding things.

So the question that remains is how are alpha values encoded/transcoded between decimal (e.g. 196608) and hexadecimal (e.g. 30000) and float (e.g. 1.00)? And how would one reverse engineer what the alpha value of, say, 0.75 is in decimal to be able to type it into .ReaperTheme?

Last edited by frenchkissaudio; 07-04-2022 at 01:10 PM. Reason: Additional information, clarity
frenchkissaudio is offline   Reply With Quote
Old 07-05-2022, 01:50 AM   #6
frenchkissaudio
Human being with feelings
 
Join Date: Jun 2022
Posts: 5
Default

I figured it out, somewhat.

My previous deduction that the _mode parameter only controls an element's alpha value was erroneous. In fact, it controls both the alpha value and the blend mode.

Code:
Here's a line from .ReaperTheme:
mute_overlay_mode=131072

Hexadecimal   Decimal   Alpha   Blend Mode

20000         131072    0.00    Normal
20001         131073    0.00    Add
20002         131074    0.00    Dodge
20003         131075    0.00    Multiply
20004         131076    0.00    Overlay

20000         131072    0.00    Normal
21000         135168    0.06    Normal
22000         139264    0.12    Normal
23000         143360    0.19    Normal
30000         196608    1.00    Normal

20001         131073    0.00    Add
21001         135169    0.06    Add
22001         139265    0.12    Add
23001         143361    0.19    Add
30001         196609    1.00    Add

^^^^^
|||||_Sets blend mode.
||||_?
|||_Increases/decreases alpha value in ~0.01 increments.
||_Increases/decreases alpha value in ~0.06 increments.
|_Seems to increase/decrease alpha value in ~1.00 increments
  and/or changes the sign.
In this case, it appears that the hexadecimal value is encoded as big endian as I didn't have to flip the order of the "bytes" to get a meaningful working pattern.

Please correct me if any of this is wrong.
frenchkissaudio is offline   Reply With Quote
Old 07-17-2022, 02:14 AM   #7
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

ColorFromNative and ColorToNative APi functions doesnt return alpha channel.

Has anyone a rgba_into to r,g,b,a Lua function (and the opposite) ? Thx !
X-Raym is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.