// This work is licensed under the Creative Commons Attribution 3.0 Unported License. // To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ // or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, // California, 94041, USA. // File: Show_Tweek_Colours.pov // Vers: 1.01 // Desc: For using the tools in Tweek_Colours.inc to arrive at a desired colour by visual selection // Date: 9 Sept 2015 // Auth: John Greenwood #version 3.7 ; #include "Tweek_Colours.inc" global_settings { assumed_gamma 1 max_trace_level 100 } background {<1,1,1>} camera{location <0,0,-120> angle 4.7 look_at <0,0,0> } light_source{<00,100,-200> rgb 1.2 parallel point_at <0,0,0> } // This programme, Find_Tweek_Colour, is a utility that uses a macro in Tweek_Colour.inc to generate an array of colours // close to a named starting colour by making small changes to (tweeking) in terms of hue, saturation and luminance. // It also has options to display all the named starting colours. // In the macro: Tweeked_Colour(Colour_name,H,S,L), Colour_name is the name of the start colour, as a string, // and H,S,L are variables that define differential changes to the starting colour. When these variables are all = 0 the colour is unchanged // Values of +/- 1 makes hardly any difference. Values of +/- 20 make a very noticable change. // Tweek_Colour.inc also contains a palette of colours identifiable both by a pigment variable and as a name as a string. // Thus SeaGreen = rgb <0.18, 0.545, 0.341> while the string "SeaGreen" put as the Colour_name will look up the same vector // which then gets tweeked to define the new rgb vector // 1 use Find_Tweek_Colour // You can see sections of the named colours as palettes named with option numbers: // 2 "Tweek_colours" // 3 "Skin" // 4 "Hair" // 5 "HTML_Red_Colours" // 6 "HTML_Yellow_Colours" // 7 "HTML_Brown_Colours" // 8 "HTML_Green_Colours" // 9 "HTML_Cyan_Colours" // 10 "HTML_Blue_Colours" // 11 "HTML_Purple_Colours" // 12 "HTML_Grey_Colours" // 13 "Pantone_named_colours" // 14 "Pantone_named_Greys" //----------------------------------------------------------------------- // To use Find_Tweek_Colour select Option = 1 in the following instruction: #declare Option = 2; #switch (Option) #case (1) // ****Here**** // Choose a colour close to what you want from one the above palettes. Put the name of this colour as a string in the following instruction and run: #local Colour_name = "SeaGreen"; // The result is 3 3x3 arrays of spheres in which the one at the centre is the named colour and the others are tweeked by all combinations of offsets. // Under each sphere is the three tweek values; Hue Tweek, Sat Tweek and Lum Tweek, that have produced this particular shade. #declare Tweek = 5; // increase this eg 20 for a bigger difference in shade. // When you get the colour you want, the rgb vector can be found in the text file Tweeked_Colours.txt // Alternatively you can include Tweek_Colours.inc and use Tweeked_Colour("name",Hue Tweek, Sat Tweek, Lum Tweek) in your progamme. // If your starting colour is some way off what you actually want, you can get it nearer intuitivly using the following settings: #local Hue_Off = 0 ; // This is change of hue in degrees. #local Sat_Off = 0 ; // Positive to increase saturation, ie more colourful, negative to make it grayer. #local Lum_Off = 0 ; // Positive to make colour lighter, negative darker. // Running the programme now will put the colour with this tweek at the center surrounded by combinations of offset from this. #local Colour = Tweeked_Colour(Colour_name,0,0,0); #local S = Chroma; #local L = Luminance; #local HT = 60*Tweek/(S*(60-Tweek)+Tweek); #local ST = Tweek*2; #local LT = (L+.1)*(2-L)*Tweek*3; #local Rad = .45; #fopen Out_File "Tweeked_Colours.txt" write #write (Out_File, Colour_name,"\n\n") text { ttf "timrom.ttf" Colour_name 1, 0 pigment {Black } scale .5 translate <-4.4,2.05,0>} #local H_Space = 3.3; #local S_Space = 1; #local L_Space = 1.2; #macro Put_Sphere(Htw,Stw,Ltw) #local Pos_in_Display = ; sphere {Pos_in_Display, Rad Tweeked_Colour(Colour_name, Hue_Off+Htw*HT ,Sat_Off+Stw*ST, Lum_Off+Ltw*LT)} text{ ttf "timrom.ttf" concat(str(Hue_Off+Htw*HT,4,0),",",str(Sat_Off+Stw*ST,4,0),",",str(Lum_Off+Ltw*LT,4,0)," ") 1, 0 pigment {Black } scale .2 translate Pos_in_Display+<-.6,-.7,0> } #if (Stw=1) #if (Htw=1) #write (Out_File, "<"vstr(3,PigV,",",5,3),">,\n") #else #write (Out_File, "<"vstr(3,PigV,",",5,3),"> ") #end #else #write (Out_File, "<"vstr(3,PigV,",",5,3),">,") #end #end Put_Sphere(-1,-1, 1) Put_Sphere(-1, 0, 1) Put_Sphere(-1, 1, 1) Put_Sphere( 0,-1, 1) Put_Sphere( 0, 0, 1) Put_Sphere( 0, 1, 1) Put_Sphere( 1,-1, 1) Put_Sphere( 1, 0, 1) Put_Sphere( 1, 1, 1) Put_Sphere(-1,-1, 0) Put_Sphere(-1, 0, 0) Put_Sphere(-1, 1, 0) Put_Sphere( 0,-1, 0) Put_Sphere( 0, 0, 0) Put_Sphere( 0, 1, 0) Put_Sphere( 1,-1, 0) Put_Sphere( 1, 0, 0) Put_Sphere( 1, 1, 0) Put_Sphere(-1,-1,-1) Put_Sphere(-1, 0,-1) Put_Sphere(-1, 1,-1) Put_Sphere( 0,-1,-1) Put_Sphere( 0, 0,-1) Put_Sphere( 0, 1,-1) Put_Sphere( 1,-1,-1) Put_Sphere( 1, 0,-1) Put_Sphere( 1, 1,-1) #break #case (2) Load_Palette ("Tweek_colours") Display_Palette ("Tweek_colours") Print_Palette("Tweek_colours") #break #case (3) Load_Palette ("Skin") Display_Palette ("Skin") Print_Palette("Skin") #break #case (4) Load_Palette ("Hair") Display_Palette ("Hair") Print_Palette("Hair") #break #case (5) Load_Palette ("HTML_Red_Colours") Display_Palette ("HTML_Red_Colours") Print_Palette("HTML_Red_Colours") #break #case (6) Load_Palette ("HTML_Yellow_Colours") Display_Palette ("HTML_Yellow_Colours") Print_Palette("HTML_Yellow_Colours") #break #case (7) Load_Palette ("HTML_Brown_Colours") Display_Palette ("HTML_Brown_Colours") Print_Palette("HTML_Brown_Colours") #break #case (8) Load_Palette ("HTML_Green_Colours") Display_Palette ("HTML_Green_Colours") Print_Palette("HTML_Green_Colours") #break #case (9) Load_Palette ("HTML_Cyan_Colours") Display_Palette ("HTML_Cyan_Colours") Print_Palette("HTML_Cyan_Colours") #break #case (10) Load_Palette ("HTML_Blue_Colours") Display_Palette ("HTML_Blue_Colours") Print_Palette("HTML_Blue_Colours") #break #case (11) Load_Palette ("HTML_Purple_Colours") Display_Palette ("HTML_Purple_Colours") Print_Palette("HTML_Purple_Colours") #break #case (12) Load_Palette ("HTML_Grey_Colours") Display_Palette ("HTML_Grey_Colours") Print_Palette("HTML_Grey_Colours") #break #case (13) Load_Palette ("Pantone_named_colours") Display_Palette ("Pantone_named_colours") Print_Palette("Pantone_named_colours") #break #case (14) Load_Palette ("Pantone_named_Greys") Display_Palette ("Pantone_named_Greys") Print_Palette("Pantone_named_Greys") #break #end