Open rageworx opened 1 year ago
Planning usertheme.xml for chaning default colors in each different path on any OS. Pathes are -
Base directory should refer to Fl_Preferences.
iTerm2 may a good reference, and many themes (xml) provided in here. https://iterm2colorschemes.com
itermcolor structure, plist xml.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.015686275437474251</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.015686275437474251</real>
<key>Red Component</key>
<real>0.015686275437474251</real>
</dict>
<key>Ansi 1 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.2010747492313385</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.29108250141143799</real>
<key>Red Component</key>
<real>0.84613037109375</real>
</dict>
<key>Ansi 10 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.17344316840171814</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.71117794513702393</real>
<key>Red Component</key>
<real>0.59946936368942261</real>
</dict>
<key>Ansi 11 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.43768906593322754</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.71335631608963013</real>
<key>Red Component</key>
<real>1</real>
</dict>
<key>Ansi 12 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.93790364265441895</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.84338563680648804</real>
<key>Red Component</key>
<real>0.59206557273864746</real>
</dict>
<key>Ansi 13 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.47304326295852661</real>
<key>Red Component</key>
<real>0.66794437170028687</real>
</dict>
<key>Ansi 14 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.89620906114578247</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.81277894973754883</real>
<key>Red Component</key>
<real>0.74220961332321167</real>
</dict>
<key>Ansi 15 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.78074795007705688</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.83679884672164917</real>
<key>Red Component</key>
<real>0.89390510320663452</real>
</dict>
<key>Ansi 2 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0078431377187371254</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.65098041296005249</real>
<key>Red Component</key>
<real>0.364705890417099</real>
</dict>
<key>Ansi 3 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.42989203333854675</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.73400628566741943</real>
<key>Red Component</key>
<real>0.9317435622215271</real>
</dict>
<key>Ansi 4 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.70196080207824707</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.47843137383460999</real>
<key>Red Component</key>
<real>0.25490197539329529</real>
</dict>
<key>Ansi 5 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.59879773855209351</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.76886701583862305</real>
<key>Red Component</key>
<real>0.89855408668518066</real>
</dict>
<key>Ansi 6 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.89620906114578247</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.81277894973754883</real>
<key>Red Component</key>
<real>0.74220961332321167</real>
</dict>
<key>Ansi 7 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.84705883264541626</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.87058824300765991</real>
<key>Red Component</key>
<real>0.85882353782653809</real>
</dict>
<key>Ansi 8 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.33635789155960083</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.33806523680686951</real>
<key>Red Component</key>
<real>0.40942513942718506</real>
</dict>
<key>Ansi 9 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.25763893127441406</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.41823640465736389</real>
<key>Red Component</key>
<real>0.84476584196090698</real>
</dict>
<key>Background Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.015686275437474251</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.015686275437474251</real>
<key>Red Component</key>
<real>0.015686275437474251</real>
</dict>
<key>Badge Color</key>
<dict>
<key>Alpha Component</key>
<real>0.5</real>
<key>Blue Component</key>
<real>9.0245162454039018e-09</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.1490195095539093</real>
<key>Red Component</key>
<real>0.99999994039535522</real>
</dict>
<key>Bold Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>1</real>
<key>Red Component</key>
<real>0.99999600648880005</real>
</dict>
<key>Cursor Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>1</real>
<key>Red Component</key>
<real>0.99607843160629272</real>
</dict>
<key>Cursor Guide Color</key>
<dict>
<key>Alpha Component</key>
<real>0.25</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.9268307089805603</real>
<key>Red Component</key>
<real>0.70213186740875244</real>
</dict>
<key>Cursor Text Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.0</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Foreground Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>1</real>
<key>Red Component</key>
<real>0.99607843160629272</real>
</dict>
<key>Link Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.73423302173614502</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.35916060209274292</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Selected Text Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>1</real>
<key>Red Component</key>
<real>0.99999600648880005</real>
</dict>
<key>Selection Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.37524169683456421</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.37524682283401489</real>
<key>Red Component</key>
<real>0.37523728609085083</real>
</dict>
<key>Tab Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.13531491160392761</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.13531494140625</real>
<key>Red Component</key>
<real>0.13531494140625</real>
</dict>
</dict>
</plist>
Colors map to real = float or double.
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.015686275437474251</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.015686275437474251</real>
<key>Red Component</key>
<real>0.015686275437474251</real>
sRGB, RGB may map to 0xFF or 0x400 (HDR10) as 1.0.
Pseudo code -
#ifndef _HDR10
const float colorSpaceWindowMax = 256;
#else
const float colorSpaceWinodwMax = 1024;
#endif /// of _HDR10
if( key.ColorSpace == sRGB )
{
float sR = key.RedComponent * key.AlpahComponent * colorSpaceWinodwMax;
float sG = key.GreeComponent * key.AlpahComponent * colorSpaceWindowMax;
float sB = key.BlueComponent * key.AlpahComponent * colorSpaceWindowMax;
}
this feature separated to brench name to "iterm2color_support"
Strange, using libtinyxml2, and reading plist through XML parsing, there's unacceptable wrong memory approaching occurs,
(debug)Ansi 0 Color::Alpha Component == 1
(debug)Ansi 0 Color::Blue Component == 0.0
(debug)Ansi 0 Color::Color Space == 0.0
(debug)Ansi 0 Color::Green Component == 0.0
(debug)Ansi 0 Color::Red Component == (null)
Process 5035 stopped
it was reason by .. ( lldb )
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x50)
frame #0: 0x000000010008aa84 tinyTerm2`tinyxml2::XMLNode::NextSiblingElement(char const*) const + 20
tinyTerm2`tinyxml2::XMLNode::NextSiblingElement:
-> 0x10008aa84 <+20>: movq 0x50(%rax), %rax
0x10008aa88 <+24>: movq %rax, -0x20(%rbp)
0x10008aa8c <+28>: cmpq $0x0, -0x20(%rbp)
0x10008aa91 <+33>: je 0x10008aad6 ; <+102>
Target 0: (tinyTerm2) stopped.
and plist(XML) structure belong to ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.0</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
Strange reading element, last
(debug)Ansi 0 Color::Alpha Component == 1
(debug)Ansi 0 Color::Blue Component == 0.0
(debug)Ansi 0 Color::Color Space == 0.0
(debug)Ansi 0 Color::Green Component == 0.0
(debug)Ansi 0 Color::Red Component == (null)
(debug)Ansi 1 Color::Alpha Component == 1
(debug)Ansi 1 Color::Blue Component == 0.40000000596046448
(debug)Ansi 1 Color::Color Space == 0.5058823823928833
(debug)Ansi 1 Color::Green Component == 0.9686274528503418
(debug)Ansi 1 Color::Red Component == (null)
It is from ...
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.0</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Ansi 1 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.40000000596046448</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.5058823823928833</real>
<key>Red Component</key>
<real>0.9686274528503418</real>
</dict>
Last
Is it a bug of libtinyXML2 ? Or something misunderstood ?
Fixed, it seems to my wrong understood. Previous code was ...
59 if( pDict != NULL )
60 {
61 XMLElement* pKA = NULL;
62 XMLElement* pKR = NULL;
63
64 size_t kroll = 0;
65
66 while( true )
67 {
68 if ( kroll == 0 )
69 {
70 pKA = pDict->FirstChildElement( "key" );
71 pKR = pDict->FirstChildElement( "real" );
72 }
73 else
74 {
75 if ( pKA != NULL )
76 pKA = pKA->NextSiblingElement( "key" );
77 if ( pKR != NULL )
78 pKR = pKR->NextSiblingElement( "real" );
79 }
It's always failure by shift "real" to "real". Finding next "real" must be belong to "key" as like this.
59 if( pDict != NULL )
60 {
61 XMLElement* pKA = NULL;
62 XMLElement* pKR = NULL;
63
64 size_t kroll = 0;
65
66 while( true )
67 {
68 if ( kroll == 0 )
69 {
70 pKA = pDict->FirstChildElement( "key" );
71 pKR = pDict->FirstChildElement( "real" );
72 }
73 else
74 {
75 if ( pKA != NULL )
76 pKA = pKA->NextSiblingElement( "key" );
77 if ( pKA != NULL )
78 pKR = pKA->NextSiblingElement( "real" );
79 }
Correct parsing xml as ...
(debug)Ansi 0 Color::Alpha Component == 1
(debug)Ansi 0 Color::Blue Component == 0.0
(debug)Ansi 0 Color::Color Space == 0.0
(debug)Ansi 0 Color::Green Component == 0.0
(debug)Ansi 0 Color::Red Component == 0.0
(debug)Ansi 1 Color::Alpha Component == 1
(debug)Ansi 1 Color::Blue Component == 0.40000000596046448
(debug)Ansi 1 Color::Color Space == 0.5058823823928833
(debug)Ansi 1 Color::Green Component == 0.5058823823928833
(debug)Ansi 1 Color::Red Component == 0.9686274528503418
(debug)Ansi 10 Color::Alpha Component == 1
(debug)Ansi 10 Color::Blue Component == 0.39215686917304993
(debug)Ansi 10 Color::Color Space == 0.82745099067687988
(debug)Ansi 10 Color::Green Component == 0.82745099067687988
(debug)Ansi 10 Color::Red Component == 0.33725491166114807
(debug)Ansi 11 Color::Alpha Component == 1
(debug)Ansi 11 Color::Blue Component == 0.25490197539329529
(debug)Ansi 11 Color::Color Space == 0.70196080207824707
(debug)Ansi 11 Color::Green Component == 0.70196080207824707
(debug)Ansi 11 Color::Red Component == 0.89019608497619629
(debug)Ansi 12 Color::Alpha Component == 1
(debug)Ansi 12 Color::Blue Component == 0.97254902124404907
(debug)Ansi 12 Color::Color Space == 0.64313727617263794
(debug)Ansi 12 Color::Green Component == 0.64313727617263794
(debug)Ansi 12 Color::Red Component == 0.42352941632270813
(debug)Ansi 13 Color::Alpha Component == 1
(debug)Ansi 13 Color::Blue Component == 0.63529413938522339
(debug)Ansi 13 Color::Color Space == 0.3803921639919281
(debug)Ansi 13 Color::Green Component == 0.3803921639919281
(debug)Ansi 13 Color::Red Component == 0.85882353782653809
(debug)Ansi 14 Color::Alpha Component == 1
(debug)Ansi 14 Color::Blue Component == 0.5372549295425415
(debug)Ansi 14 Color::Color Space == 0.45490196347236633
(debug)Ansi 14 Color::Green Component == 0.45490196347236633
(debug)Ansi 14 Color::Red Component == 0.16862745583057404
(debug)Ansi 15 Color::Alpha Component == 1
(debug)Ansi 15 Color::Blue Component == 1
(debug)Ansi 15 Color::Color Space == 1
(debug)Ansi 15 Color::Green Component == 1
(debug)Ansi 15 Color::Red Component == 1
(debug)Ansi 2 Color::Alpha Component == 1
(debug)Ansi 2 Color::Blue Component == 0.39215686917304993
(debug)Ansi 2 Color::Color Space == 0.82745099067687988
(debug)Ansi 2 Color::Green Component == 0.82745099067687988
(debug)Ansi 2 Color::Red Component == 0.33725491166114807
(debug)Ansi 3 Color::Alpha Component == 1
(debug)Ansi 3 Color::Blue Component == 0.25490197539329529
(debug)Ansi 3 Color::Color Space == 0.70196080207824707
(debug)Ansi 3 Color::Green Component == 0.70196080207824707
(debug)Ansi 3 Color::Red Component == 0.89019608497619629
(debug)Ansi 4 Color::Alpha Component == 1
(debug)Ansi 4 Color::Blue Component == 0.97254902124404907
(debug)Ansi 4 Color::Color Space == 0.64313727617263794
(debug)Ansi 4 Color::Green Component == 0.64313727617263794
(debug)Ansi 4 Color::Red Component == 0.42352941632270813
(debug)Ansi 5 Color::Alpha Component == 1
(debug)Ansi 5 Color::Blue Component == 0.63529413938522339
(debug)Ansi 5 Color::Color Space == 0.3803921639919281
(debug)Ansi 5 Color::Green Component == 0.3803921639919281
(debug)Ansi 5 Color::Red Component == 0.85882353782653809
(debug)Ansi 6 Color::Alpha Component == 1
(debug)Ansi 6 Color::Blue Component == 0.5372549295425415
(debug)Ansi 6 Color::Color Space == 0.45490196347236633
(debug)Ansi 6 Color::Green Component == 0.45490196347236633
(debug)Ansi 6 Color::Red Component == 0.16862745583057404
(debug)Ansi 7 Color::Alpha Component == 1
(debug)Ansi 7 Color::Blue Component == 1
(debug)Ansi 7 Color::Color Space == 1
(debug)Ansi 7 Color::Green Component == 1
(debug)Ansi 7 Color::Red Component == 1
(debug)Ansi 8 Color::Alpha Component == 1
(debug)Ansi 8 Color::Blue Component == 0.30000001192092896
(debug)Ansi 8 Color::Color Space == 0.30000001192092896
(debug)Ansi 8 Color::Green Component == 0.30000001192092896
(debug)Ansi 8 Color::Red Component == 0.30000001192092896
(debug)Ansi 9 Color::Alpha Component == 1
(debug)Ansi 9 Color::Blue Component == 0.40000000596046448
(debug)Ansi 9 Color::Color Space == 0.5058823823928833
(debug)Ansi 9 Color::Green Component == 0.5058823823928833
(debug)Ansi 9 Color::Red Component == 0.9686274528503418
(debug)Background Color::Alpha Component == 1
(debug)Background Color::Blue Component == 0.086274512112140656
(debug)Background Color::Color Space == 0.070588238537311554
(debug)Background Color::Green Component == 0.070588238537311554
(debug)Background Color::Red Component == 0.062745101749897003
(debug)Badge Color::Alpha Component == 0.5
(debug)Badge Color::Blue Component == 0.99215686321258545
(debug)Badge Color::Color Space == 0.54509806632995605
(debug)Badge Color::Green Component == 0.54509806632995605
(debug)Badge Color::Red Component == 0.21960784494876862
(debug)Bold Color::Alpha Component == 1
(debug)Bold Color::Blue Component == 0.85098040103912354
(debug)Bold Color::Color Space == 0.81960785388946533
(debug)Bold Color::Green Component == 0.81960785388946533
(debug)Bold Color::Red Component == 0.78823530673980713
(debug)Cursor Color::Alpha Component == 1
(debug)Cursor Color::Blue Component == 0.85098040103912354
(debug)Cursor Color::Color Space == 0.81960785388946533
(debug)Cursor Color::Green Component == 0.81960785388946533
(debug)Cursor Color::Red Component == 0.78823530673980713
(debug)Cursor Guide Color::Alpha Component == 0.25
(debug)Cursor Guide Color::Blue Component == 1
(debug)Cursor Guide Color::Color Space == 0.9268307089805603
(debug)Cursor Guide Color::Green Component == 0.9268307089805603
(debug)Cursor Guide Color::Red Component == 0.70213186740875244
(debug)Cursor Text Color::Alpha Component == 1
(debug)Cursor Text Color::Blue Component == 0.086274512112140656
(debug)Cursor Text Color::Color Space == 0.070588238537311554
(debug)Cursor Text Color::Green Component == 0.070588238537311554
(debug)Cursor Text Color::Red Component == 0.062745101749897003
(debug)Foreground Color::Alpha Component == 1
(debug)Foreground Color::Blue Component == 0.61960786581039429
(debug)Foreground Color::Color Space == 0.58039218187332153
(debug)Foreground Color::Green Component == 0.58039218187332153
(debug)Foreground Color::Red Component == 0.54509806632995605
(debug)Link Color::Alpha Component == 1
(debug)Link Color::Blue Component == 1
(debug)Link Color::Color Space == 0.65098041296005249
(debug)Link Color::Green Component == 0.65098041296005249
(debug)Link Color::Red Component == 0.34509804844856262
(debug)Selected Text Color::Alpha Component == 1
(debug)Selected Text Color::Blue Component == 1
(debug)Selected Text Color::Color Space == 1
(debug)Selected Text Color::Green Component == 1
(debug)Selected Text Color::Red Component == 1
(debug)Selection Color::Alpha Component == 1
(debug)Selection Color::Blue Component == 0.43921568989753723
(debug)Selection Color::Color Space == 0.31372550129890442
(debug)Selection Color::Green Component == 0.31372550129890442
(debug)Selection Color::Red Component == 0.23137255012989044
itermcolors/GitHub Dark.itermcolors load OK.
from "GitHub Dark.itermcolors".
Original FLTerm don't support changing termional color scheme/theme at all. Supports user color definition as like MSYS2.