1. Max(RGB) = Maxmimum value among original R, G, B

2. Min(RGB) = Minimum value among original R, G, B

3. compR = (Max(RGB) + Min(RGB)) - originalR

4. compG = (Max(RGB) + Min(RGB)) - originalG

5. compB = (Max(RGB) + Min(RGB)) - originalB

6. complementary color = compR, compG, compB

For example, complementary color for (50, 100, 200) is (200+50-50, 200+50-100, 200+50-200) = (200, 150, 50).

Sample code is:

Code: Select all

`[Rainmeter]`

Update=5000

[GenerateColorR]

Measure=Calc

Formula=Random

UpdateRandom=1

Lowbound=0

HighBound=255

[GenerateColorG]

Measure=Calc

Formula=Random

UpdateRandom=1

Lowbound=0

HighBound=255

[GenerateColorB]

Measure=Calc

Formula=Random

UpdateRandom=1

Lowbound=0

HighBound=255

[GenerateColorRGB]

Measure=String

String="[GenerateColorR],[GenerateColorG],[GenerateColorB]"

DynamicVariables=1

[GenerateColorMaxRGB]

Measure=Calc

Formula=Max(Max([GenerateColorR],[GenerateColorG]),[GenerateColorB])

DynamicVariables=1

[GenerateColorMinRGB]

Measure=Calc

Formula=Min(Min([GenerateColorR],[GenerateColorG]),[GenerateColorB])

DynamicVariables=1

[ComplColorR]

Measure=Calc

Formula=([GenerateColorMaxRGB]+[GenerateColorMinRGB]) - [GenerateColorR]

DynamicVariables=1

[ComplColorG]

Measure=Calc

Formula=([GenerateColorMaxRGB]+[GenerateColorMinRGB]) - [GenerateColorG]

DynamicVariables=1

[ComplColorB]

Measure=Calc

Formula=([GenerateColorMaxRGB]+[GenerateColorMinRGB]) - [GenerateColorB]

DynamicVariables=1

[ComplColorRGB]

Measure=String

String="[ComplColorR],[ComplColorG],[ComplColorB]"

DynamicVariables=1

[SquareOriginal]

Meter=Shape

Shape=Rectangle 0,0,75,100,5 | Fill Color [GenerateColorRGB]

DynamicVariables=1

[SquareCompl]

Meter=Shape

Shape=Rectangle 80,0,75,100,5 | Fill Color [ComplColorRGB]

DynamicVariables=1

If color code is provided as R,G,B expression, RegExpSubstitute

`"^(.*),(.*),(.*)$":"\1"`

may help to get separate R, G, and B values.