Results 1 to 15 of 15

Thread: Colors Writeln'er.

  1. #1
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default Colors Writeln'er.

    Really easy, but when you need to debug colors its always annoying to make a simple writeln'er. Thats why i made this very simple "script", but handy..
    Change the colors in Init to whatever you want to debug..:
    SCAR Code:
    program New;
    //By Mastaraymond
    //0 = Min
    //1 = Max
    var
      I,II : integer;
      RGBColor : Array[1..3] of Integer;
      RGB : Array[0..1] of Array[1..3] of Integer;
      XYZColor, HSLColor : Array[1..3] of Extended;
      HSL,XYZ : Array[0..1] of Array[1..3] of Extended;
      Colors : TIntegerArray;
      Strings : Array[0..9] of String;
    Procedure Init;
    begin;
      Colors := [6396770,5749833,7122792,10408078,5681475,5674327];
    end;
    begin
      Init;
      For I:= 1 to 3 do
      begin;
        Writeln('');
        RGB[0][I] := 255;
        HSL[0][I] := 255; //Max is 240?
        XYZ[0][I] := 255; //Max is ...?
      end;
      Strings[1] := 'R: ';
      Strings[0] := '   ';
      Strings[2] := 'G: ';
      Strings[3] := 'B: ';
      Strings[4] := 'H: ';
      Strings[5] := 'S: ';
      Strings[6] := 'L: ';
      Strings[7] := 'X: ';
      Strings[8] := 'Y: ';
      Strings[9] := 'Z: ';
      For I:= 0 to High(Colors) do
      begin;
        Strings[0] := Strings[0] + Padr('Color: '+inttostr(Colors[I]),16) +' | ';
        ColortoRGB(Colors[I],RGBColor[1],RGBColor[2],RGBColor[3]);
        ColortoHSL(Colors[I],HSLColor[1],HSLColor[2],HSLColor[3]);
        ColortoXYZ(Colors[I],XYZColor[1],XYZColor[2],XYZColor[3]);
        For II:= 1 to 3 do
        begin;
          RGB[0][II] := Min(RGBColor[II],RGB[0][II]);
          RGB[1][II] := Max(RGBColor[II],RGB[1][II]);
          HSL[0][II] := MinE(HSLColor[II],HSL[0][II]);
          HSL[1][II] := MaxE(HSLColor[II],HSL[1][II]);
          XYZ[0][II] := MinE(XYZColor[II],XYZ[0][II]);
          XYZ[1][II] := MaxE(XYZColor[II],XYZ[1][II]);
        end;
        For II := 1 to 3 do
          Strings[II] := Strings[II] +Padr(IntToStr  (RGBColor[II]),16) +' | ';
        For II := 4 to 6 do
          Strings[II] := Strings[II] +Padr(FloatToStr(HSLColor[II-3]),16) +' | ';
        For II := 7 to 9 do
          Strings[II] := Strings[II] +Padr(FloatToStr(XYZColor[II-6]),16) +' | ';
      end;
      For I:= 0 to 9 do
        Delete(Strings[I],Length(Strings[I])-2,3);
      For I:= 0 to 9 do
      begin;
        if (I = 1) or (I = 4)or (I = 7)  then Writeln('');
        Writeln(Strings[I]);
      end;
      Writeln('');
      Writeln('Highest RGB values = R: '+ Padr(FloatToStr(RGB[1][1]),3) +  ' | ' +'G: '+ Padr(FloatToStr(RGB[1][2]),3)  +  ' | ' +'B: '+ Padr(FloatToStr(RGB[1][3]),3) );
      Writeln('Lowest  RGB values = R: '+ Padr(FloatToStr(RGB[0][1]),3) +  ' | ' +'G: '+ Padr(FloatToStr(RGB[0][2]),3)  +  ' | ' +'B: '+ Padr(FloatToStr(RGB[0][3]),3) );
      Writeln('Differ  RGB values = R: '+ Padr(IntToStr(RGB[1][1] - RGB[0][1]),3) + ' | G: '+ Padr(inttostr(RGB[1][2] - RGB[0][2]) ,3) + ' | B: '+Padr(inttostr(RGB[1][3] - RGB[0][3]),3));
      Writeln('Middle  RGB values = R: '+ Padr(IntToStr((RGB[1][1] + RGB[0][1]) div 2),3) + ' | G: '+ Padr(inttostr((RGB[1][2] + RGB[0][2]) div 2),3) + ' | B: '+Padr(inttostr((RGB[1][3] + RGB[0][3]) div 2),3));
      Writeln('Middle  RGB color  = '   + IntToStr(RGBToColor((RGB[1][1] + RGB[0][1]) div 2,(RGB[1][2] + RGB[0][2]) div 2,(RGB[1][3] + RGB[0][3]) div 2)));
      Writeln('');
      Writeln('Highest HSL values = H: '+ Padr(FloatToStr(HSL[1][1]),16) +  ' | ' +'S: '+ Padr(FloatToStr(HSL[1][2]),16)  +  ' | ' +'L: '+ Padr(FloatToStr(HSL[1][3]),16) );
      Writeln('Lowest  HSL values = H: '+ Padr(FloatToStr(HSL[0][1]),16) +  ' | ' +'S: '+ Padr(FloatToStr(HSL[0][2]),16)  +  ' | ' +'L: '+ Padr(FloatToStr(HSL[0][3]),16) );
      Writeln('Differ  HSL values = H: '+ Padr(FloatToStr(HSL[1][1] - HSL[0][1]),16) + ' | S: '+ Padr(FloatToStr(HSL[1][2] - HSL[0][2]) ,16) + ' | L: '+Padr(FloatToStr(HSL[1][3] - HSL[0][3]),16));
      Writeln('Middle  HSL values = H: '+ FloatToStr((HSL[1][1] + HSL[0][1]) div 2) + ' | S: '+ FloatToStr((HSL[1][2] + HSL[0][2]) div 2) + ' | L: '+FloatToStr((HSL[1][3] + HSL[0][3]) div 2));
      Writeln('Middle  HSL color  = '   + IntToStr(HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2)));
      Writeln('');
      Writeln('Highest XYZ values = X: '+ Padr(FloatToStr(XYZ[1][1]),16) +  ' | ' +'Y: '+ Padr(FloatToStr(XYZ[1][2]),16)  +  ' | ' +'Z: '+ Padr(FloatToStr(XYZ[1][3]),16) );
      Writeln('Lowest  XYZ values = X: '+ Padr(FloatToStr(XYZ[0][1]),16) +  ' | ' +'Y: '+ Padr(FloatToStr(XYZ[0][2]),16)  +  ' | ' +'Z: '+ Padr(FloatToStr(XYZ[0][3]),16) );
      Writeln('Differ  XYZ values = X: '+ Padr(FloatToStr(XYZ[1][1] - XYZ[0][1]),16) + ' | Y: '+ Padr(FloatToStr(XYZ[1][2] - XYZ[0][2]) ,16) + ' | Z: '+Padr(FloatToStr(XYZ[1][3] - XYZ[0][3]),16));
      Writeln('Middle  XYZ values = X: '+ FloatToStr((XYZ[1][1] + XYZ[0][1]) div 2) + ' | Y: '+ FloatToStr((XYZ[1][2] + XYZ[0][2]) div 2) + ' | Z: '+FloatToStr((XYZ[1][3] + XYZ[0][3]) div 2));
      Writeln('Middle  XYZ color  = '   + IntToStr(XYZToColor((XYZ[1][1] + XYZ[0][1]) div 2,(XYZ[1][2] + XYZ[0][2]) div 2,(XYZ[1][3] + XYZ[0][3]) div 2)));
      WritelN('');
    end.

    ~Raymond
    Verrekte Koekwous

  2. #2
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Hehe, gj, though writing one takes less time than surfing to srl and finding this topic =/

    Public Test Corner Post your procedures and functions here
    ... I'd prefer the Ol' snippets section xD

  3. #3
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    Hehe, gj, though writing one takes less time than surfing to srl and finding this topic =/

    ... I'd prefer the Ol' snippets section xD
    Yeah to bad they removed it.. Oh btw.. It doesn't take less time... I always hate to make a writelner... So this time I decided to make a good one .
    Verrekte Koekwous

  4. #4
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Oh, you are talking about "writelner" - I thought you ment open new tab, make h, s, l extendeds, and do ColorToHSL(Color, H, S, L); Writeln(FloatToStr(H) + ' ' etc..

  5. #5
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    'Updated'.. It now calculates the highest value of each and the lowest value. Then it calculates the color that would be between those 2 values....

    ~Raymond
    Verrekte Koekwous

  6. #6
    Join Date
    Feb 2007
    Location
    SparklesProd.com
    Posts
    2,406
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Haha, I thought this topic mean you'd created a function to Writeln in different colors! I was like

  7. #7
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sp0rky View Post
    Haha, I thought this topic mean you'd created a function to Writeln in different colors! I was like
    If you know a better title ^^.
    Verrekte Koekwous

  8. #8
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    This is how I get the middle of some colors:

    SCAR Code:
    Function GetCC: Integer; // Very useful for getting middle of light and dark
    Var
      HSL: Array of Array of Extended;
    Var
      H, S, L: Extended;
    Var
      Colors: TIntegerArray;
    Var
      C: Integer;
    Begin
      Colors := [3032389, 2110002];
      SetArrayLength(HSL, 2);
      SetArrayLength(HSL[0], 3);
      SetArrayLength(HSL[1], 3);
      For C := 0 To 1 Do
      Begin
        ColorToHSL(Colors[c], HSL[c][0], HSL[c][1], HSL[c][2]);
      End;
      H := HSL[1][0] - ((HSL[1][0] - HSL[0][0])/4);
      S := HSL[1][1] - ((HSL[1][1] - HSL[0][1])/4);
      L := HSL[1][2] - ((HSL[1][2] - HSL[0][2])/2);
      Result := HSLToColor(H, S, L);
    End;

    Current colors ther are light and dark colors of coal.

  9. #9
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    This is how I get the middle of some colors:

    SCAR Code:
    Function GetCC: Integer; // Very useful for getting middle of light and dark
    Var
      HSL: Array of Array of Extended;
    Var
      H, S, L: Extended;
    Var
      Colors: TIntegerArray;
    Var
      C: Integer;
    Begin
      Colors := [3032389, 2110002];
      SetArrayLength(HSL, 2);
      SetArrayLength(HSL[0], 3);
      SetArrayLength(HSL[1], 3);
      For C := 0 To 1 Do
      Begin
        ColorToHSL(Colors[c], HSL[c][0], HSL[c][1], HSL[c][2]);
      End;
      H := HSL[1][0] - ((HSL[1][0] - HSL[0][0])/4);
      S := HSL[1][1] - ((HSL[1][1] - HSL[0][1])/4);
      L := HSL[1][2] - ((HSL[1][2] - HSL[0][2])/2);
      Result := HSLToColor(H, S, L);
    End;

    Current colors ther are light and dark colors of coal.
    Its not the 'real' middle^^. So its adjusted to dark and light? Its really color depending if im right .
    Anyway 'updated'.
    Verrekte Koekwous

  10. #10
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    The snippet I posted gets the approximately "middle" looking color, I tried with lesser demon and compared with eye, same with coal, and with ~10 tol everything is fine

  11. #11
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Nice little snippet


  12. #12
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Bobarkinator View Post
    Nice little snippet
    Thx .
    Verrekte Koekwous

  13. #13
    Join Date
    Mar 2007
    Posts
    3,681
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sp0rky View Post
    Haha, I thought this topic mean you'd created a function to Writeln in different colors! I was like
    lol sme here

  14. #14
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Good job Raymond...even though I have no idea what it does
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  15. #15
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Santa_Clause View Post
    Good job Raymond...even though I have no idea what it does
    It gives you some information about colors ^^.

    Example:

    Differ HSL values = H: 0,101011991500854 | S: 2,00589895248413 | L: 4,50980365276337

    Middle HSL color = 1784651

    The Differ is the value between the highest and the lowest.. So if i use the middle color, you must divide the differs. Max +Min div 2 = Middle.. ^^.
    When we divided them we can use them as modifiers, in colortolerancespeed(2);
    I would use : SetColorspeed2Modifiers(0.006,0.11); And as tol 3...
    Because: 0.006 * 10 = 0.06, 0.06 * 2 = 0.12. (Higher then the differ).
    0.11 * 10 = 1.1, 1.1 * 2 = 2.2. (Higher then the differ).
    The tol because
    3*2 = 6 (Higher then the differ).

    Ok, this is a explanation of nothing.. Nobody would probably get it, but i tried ^^.

    ~Raymond
    Verrekte Koekwous

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. colors
    By Iroki in forum OSR Help
    Replies: 1
    Last Post: 10-06-2008, 08:09 PM
  2. New Colors !!!
    By XxtOmxX in forum RS has been updated.
    Replies: 13
    Last Post: 06-05-2007, 02:02 PM
  3. Getting axe colors.
    By kooldude in forum OSR Help
    Replies: 3
    Last Post: 04-17-2007, 09:07 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •