Old 01-19-2020, 04:22 AM   #1
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default Is it possible to change a theme color with Reascript?

Hello!


What the title asks. And if yes, how?


Thanks!
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 01-20-2020, 01:44 AM   #2
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

I guess we still don't have the API to do it...
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 01-22-2020, 09:25 AM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
Default

Which theme-color do you want to change?

My first guess would be, that you need to alter the Themename.ReaperTheme-file, who are regular ini-files.
Just use:
https://mespotin.uber.space/Ultrasch...eProfileString
https://mespotin.uber.space/Ultrasch...eProfileString
for that.

After that, you can simply reload the theme using: OpenColorThemeFile
https://mespotin.uber.space/Ultrasch...ColorThemeFile

Only works with unzipped themes, though.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 01-22-2020, 09:44 AM   #4
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

I'm not familiar with the syntax or any limitations, but I would expect the new theme variables to be able to do this - if you had a theme written specifically to support it.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 01-22-2020, 09:46 AM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
Default

Not with the colors, as they are not stored in the rtconfig-file, where the ThemeLayout-parameters are stored in.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 01-22-2020, 10:45 AM   #6
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Quote:
Originally Posted by mespotine View Post
Which theme-color do you want to change?

My first guess would be, that you need to alter the Themename.ReaperTheme-file, who are regular ini-files.
Just use:
https://mespotin.uber.space/Ultrasch...eProfileString
https://mespotin.uber.space/Ultrasch...eProfileString
for that.

After that, you can simply reload the theme using: OpenColorThemeFile
https://mespotin.uber.space/Ultrasch...ColorThemeFile

Only works with unzipped themes, though.

Yay! It works! I didn't expected it to... Thank you very much!!


sample code
Code:
local filePath =  reaper.GetResourcePath() .. "\\ColorThemes\\test.ReaperTheme"
if not reaper.file_exists( filePath ) then
  reaper.MB( "Specified ColorTheme file path: " .. filePath, "ColorTheme does not exist!", 0 )
  return
end
local _, value = reaper.BR_Win32_GetPrivateProfileString( "color theme", "col_arrangebg", "does not exist", filePath )
reaper.ShowConsoleMsg("Old value of col_arrangebg: " .. value)
local newcolor =  reaper.ColorToNative( 56, 78, 112 )
reaper.BR_Win32_WritePrivateProfileString( "color theme", "col_arrangebg", tostring(newcolor) , filePath )
reaper.OpenColorThemeFile( filePath )
reaper.defer(function() end)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 01-22-2020, 10:55 AM   #7
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

The idea is to make a script that could change all theme colors providing functions like Contrast, Brightness and Saturation, like image editors do. Or even provide a function to automatically make all the color scheme WCAGLevel AA/AAA compliant.



Of course all this needs a lot of work and a lot of time...
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 01-22-2020, 11:37 AM   #8
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
Default

Looking forward to it
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 01-23-2020, 06:05 AM   #9
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

It seems that not all numbers in rtconfig under [color theme] are colors...
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 01-23-2020, 07:03 AM   #10
White Tie
Pixel Pusher
 
White Tie's Avatar
 
Join Date: Mar 2007
Location: Blighty
Posts: 4,982
Default

Yeah, this is a bit of a can of worms. But a more experienced programmer than I should be able to do something very useful if they're okay with:
  1. The fact its only ever going to work on an unpacked theme, which is a bummer.
  2. Picking through the minutiae of how colours reside in many places, and in differing colour formats. Some in the rtconfig, some in the .reapertheme file, and some hard written into bitmaps depending on the theme.

I would heartily encourage any efforts in this, however, because even a partial implementation could still be very useful.
__________________
The House of White Tie
White Tie is offline   Reply With Quote
Old 01-23-2020, 10:47 AM   #11
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

If I knew in which format is the value of every key in there, maybe I could do something... But it needs a lot of reverse engineering to find out.. And I can't understand why they should be in different formats and all over the place!.. :/
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma 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 03:58 AM.


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