colo-rgb.mkii / last modification: 2020-01-30 14:15
%D \module
%D   [       file=colo-rgb,
%D        version=1995.01.01,
%D          title=\CONTEXT\ Color Macros,
%D       subtitle=RGB,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for 
%C details. 

%D Just to give users a start we define some colors. While
%D switching fonts is as international as can be, thanks to the
%D mnemonics, naming colors is very interface dependant. To
%D support international setups, we define both english and
%D interface dependant colors. We use the color inheritance
%D mechanisms to implement the interface dependant ones.

%D First we define some simple primary \cap{RGB} and \cap{CMYK} 
%D colors. All colors are defined in \cap{RGB} color space.

\definecolor [red]           [r=1,   g=0,   b=0]
\definecolor [green]         [r=0,   g=1,   b=0]
\definecolor [blue]          [r=0,   g=0,   b=1]

\definecolor [cyan]          [r=0,   g=1,   b=1]
\definecolor [magenta]       [r=1,   g=0,   b=1]
\definecolor [yellow]        [r=1,   g=1,   b=0]

\definecolor [white]         [s=1] % [r=1,   g=1,   b=1]
\definecolor [black]         [s=0] 
\definecolor [gray]          [s=.9]

\definecolor [darkred]       [r=.8,  g=0,   b=0]
\definecolor [middlered]     [r=.9,  g=0,   b=0]
\definecolor [lightred]      [r=1,   g=0,   b=0]

\definecolor [darkgreen]     [r=0,   g=.6,  b=0]
\definecolor [middlegreen]   [r=0,   g=.8,  b=0]
\definecolor [lightgreen]    [r=0,   g=1,   b=0]

\definecolor [darkblue]      [r=0,   g=0,   b=.8]
\definecolor [middleblue]    [r=0,   g=0,   b=.9]
\definecolor [lightblue]     [r=0,   g=0,   b=1]

\definecolor [darkcyan]      [r=.6,  g=.8,  b=.8]
\definecolor [middlecyan]    [r=0,   g=.8,  b=.8]

\definecolor [darkmagenta]   [r=.8,  g=.6,  b=.8]
\definecolor [middlemagenta] [r=1,   g=0,   b=.6]

\definecolor [darkyellow]    [r=.8,  g=.8,  b=.6]
\definecolor [middleyellow]  [r=1,   g=1,   b=.2]

\definecolor [darkgray]      [s=.5]
\definecolor [middlegray]    [s=.7]
\definecolor [lightgray]     [s=.9]

%D These colors are mapped to interface dependant colornames.

\startinterface dutch

  \definecolor [rood]          [red]
  \definecolor [groen]         [green]
  \definecolor [blauw]         [blue]

  \definecolor [cyaan]         [cyan]
  \definecolor [magenta]       [magenta]
  \definecolor [geel]          [yellow]

  \definecolor [wit]           [white]
  \definecolor [grijs]         [gray]
  \definecolor [zwart]         [black]

  \definecolor [donkerrood]    [darkred]
  \definecolor [middelrood]    [middlered]
  \definecolor [lichtrood]     [lightred]

  \definecolor [donkergroen]   [darkgreen]
  \definecolor [middelgroen]   [middlegreen]
  \definecolor [lichtgroen]    [lightgreen]

  \definecolor [donkerblauw]   [darkblue]
  \definecolor [middelblauw]   [middleblue]
  \definecolor [lichtblauw]    [lightblue]

  \definecolor [donkercyaan]   [darkcyan]
  \definecolor [middelcyaan]   [middlecyan]

  \definecolor [donkermagenta] [darkmagenta]
  \definecolor [middelmagenta] [middlemagenta]

  \definecolor [donkergeel]    [darkyellow]
  \definecolor [middelgeel]    [middleyellow]

  \definecolor [donkergrijs]   [darkgray]
  \definecolor [middengrijs]   [middlegray]
  \definecolor [lichtgrijs]    [lightgray]

\stopinterface

\startinterface german

  \definecolor [rot]           [red]
  \definecolor [gruen]         [green]
  \definecolor [blau]          [blue]

  \definecolor [cyan]          [cyan]
  \definecolor [magenta]       [magenta]
  \definecolor [gelb]          [yellow]

  \definecolor [weiss]         [white]
  \definecolor [grau]          [gray]
  \definecolor [schwarz]       [black]

  \definecolor [dunkelrot]     [darkred]
  \definecolor [mittelrot]     [middlered]
  \definecolor [hellrot]       [lightred]

  \definecolor [dunkelgruen]   [darkgreen]
  \definecolor [mittelgruen]   [middlegreen]
  \definecolor [hellgruen]     [lightgreen]

  \definecolor [dunkelblau]    [darkblue]
  \definecolor [mittelblau]    [middleblue]
  \definecolor [hellblau]      [lightblue]

  \definecolor [dunkelcyan]    [darkcyan]
  \definecolor [mittelcyan]    [middlecyan]

  \definecolor [dunkelmagenta] [darkmagenta]
  \definecolor [mittelmagenta] [middlemagenta]

  \definecolor [dunkelgelb]    [darkyellow]
  \definecolor [mittelgelb]    [middleyellow]

  \definecolor [dunkelgrau]    [darkgray]
  \definecolor [mittelgrau]    [middlegray]
  \definecolor [hellgrau]      [lightgray]

\stopinterface

\startinterface czech

  \definecolor [cervena]        [red]
  \definecolor [zelena]         [green]
  \definecolor [modra]          [blue]

  \definecolor [azurova]        [cyan]
  \definecolor [fialova]        [magenta]
  \definecolor [zluta]          [yellow]

  \definecolor [bila]           [white]
  \definecolor [cerna]          [black]

  \definecolor [tmavecervena]   [darkred]
  \definecolor [strednecervena] [middlered]
  \definecolor [svetlecervena]  [lightred]

  \definecolor [tmavezelena]    [darkgreen]
  \definecolor [strednezelena]  [middlegreen]
  \definecolor [svetlezelena]   [lightgreen]

  \definecolor [tmavemodra]     [darkblue]
  \definecolor [strednemodra]   [middleblue]
  \definecolor [svetlemodra]    [lightblue]

  \definecolor [tmaveazurova]   [darkcyan]
  \definecolor [stredneazurova] [middlecyan]

  \definecolor [tmavefialova]   [darkmagenta]
  \definecolor [strednefialova] [middlemagenta]

  \definecolor [tmavezluta]     [darkyellow]
  \definecolor [strednezluta]   [middleyellow]

  \definecolor [tmaveseda]      [darkgray]
  \definecolor [stredneseda]    [middlegray]
  \definecolor [svetleseda]     [lightgray]

\stopinterface

\startinterface italian

  \definecolor [rosso]         [red]
  \definecolor [verde]         [green]
  \definecolor [blu]           [blue]

  \definecolor [azzurro]       [cyan]
  \definecolor [turchino]      [cyan]
  \definecolor [ciano]         [cyan]
  \definecolor [cremisi]       [magenta]
  \definecolor [giallo]        [yellow]

  \definecolor [bianco]        [white]
  \definecolor [grigio]        [gray]
  \definecolor [nero]          [black]

  \definecolor [rossoscuro]    [darkred]
  \definecolor [rossomedio]    [middlered]
  \definecolor [rossochiaro]   [lightred]

  \definecolor [verdescuro]    [darkgreen]
  \definecolor [verdemedio]    [middlegreen]
  \definecolor [verdechiaro]   [lightgreen]

  \definecolor [bluscuro]      [darkblue]
  \definecolor [blumedio]      [middleblue]
  \definecolor [bluchiaro]     [lightblue]

  \definecolor [azzurroscuro]  [darkcyan]
  \definecolor [azzurrochiaro] [middlecyan]      

  \definecolor [cremisiscuro]  [darkmagenta]    
  \definecolor [cremisichiaro] [middlemagenta]  


  \definecolor [gialloscuro]     [darkyellow]
  \definecolor [giallomedio]     [middleyellow]

  \definecolor [grigioscuro]     [darkgray]
  \definecolor [grigiomedio]     [middlegray]
  \definecolor [grigiochiaro]    [lightgray]

\stopinterface

\startinterface romanian

  \definecolor [rosu]            [red]
  \definecolor [verde]           [green]
  \definecolor [albastru]        [blue]

  \definecolor [cian]            [cyan]
  \definecolor [magenta]         [magenta]
  \definecolor [galben]          [yellow]

  \definecolor [alb]             [white]
  \definecolor [gri]             [gray]
  \definecolor [negru]           [black]

  \definecolor [rosuinchis]      [darkred]
  \definecolor [rosumediu]       [middlered]
  \definecolor [rosudeschis]     [lightred]

  \definecolor [verdeinchis]     [darkgreen]
  \definecolor [verdemediu]      [middlegreen]
  \definecolor [verdedeschis]    [lightgreen]

  \definecolor [albastruinchis]  [darkblue]
  \definecolor [albastrumediu]   [middleblue]
  \definecolor [albastrudeschis] [lightblue]

  \definecolor [cianinchis]      [darkcyan]
  \definecolor [cianmediu]       [middlecyan]

  \definecolor [magentainchis]   [darkmagenta]
  \definecolor [magentamediu]    [middlemagenta]

  \definecolor [galbeninchis]    [darkyellow]
  \definecolor [galbenmediu]     [middleyellow]

  \definecolor [griinchis]       [darkgray]
  \definecolor [grimediu]        [middlegray]
  \definecolor [grideschis]      [lightgray]

\stopinterface

%D Like colors, we first define the english colorgroups. These
%D colorgroups are tuned for distinctive gray scale printing.

% todo : more efficient and real gray 

\definecolorgroup
  [gray]
  [0.95:0.95:0.95,
   0.90:0.90:0.90,
   0.80:0.80:0.80,
   0.70:0.70:0.70,
   0.60:0.60:0.60,
   0.50:0.50:0.50,
   0.40:0.40:0.40,
   0.30:0.30:0.30,
   0.20:0.20:0.20,
   0.10:0.10:0.10,
   0.00:0.00:0.00]

\definecolorgroup
  [red]
  [1.00:0.90:0.90,
   1.00:0.80:0.80,
   1.00:0.70:0.70,
   1.00:0.55:0.55,
   1.00:0.40:0.40,
   1.00:0.25:0.25,
   1.00:0.15:0.15,
   0.90:0.00:0.00]

\definecolorgroup
  [green]
  [0.90:1.00:0.90,
   0.70:1.00:0.70,
   0.50:1.00:0.50,
   0.30:1.00:0.30,
   0.15:0.90:0.15,
   0.00:0.80:0.00,
   0.00:0.65:0.00,
   0.00:0.50:0.00]

\definecolorgroup
  [blue]
  [0.90:0.95:1.00,
   0.80:0.90:1.00,
   0.55:0.85:1.00,
   0.30:0.80:1.00,
   0.15:0.75:1.00,
   0.00:0.70:1.00,
   0.00:0.55:1.00,
   0.00:0.40:1.00]

\definecolorgroup
  [cyan]
  [0.80:1.00:1.00,
   0.60:1.00:1.00,
   0.30:1.00:1.00,
   0.00:0.95:0.95,
   0.00:0.85:0.85,
   0.00:0.75:0.75,
   0.00:0.60:0.60,
   0.00:0.50:0.50]

\definecolorgroup
  [magenta]
  [1.00:0.90:1.00,
   1.00:0.80:1.00,
   1.00:0.65:1.00,
   1.00:0.50:1.00,
   1.00:0.35:1.00,
   1.00:0.15:1.00,
   0.90:0.05:0.90,
   0.80:0.00:0.80]

\definecolorgroup
   [yellow]
   [1.00:1.00:0.70,
    1.00:1.00:0.00,
    1.00:0.85:0.05,
    1.00:0.70:0.00,
    1.00:0.55:0.00,
    0.95:0.40:0.00,
    0.80:0.30:0.00,
    0.60:0.30:0.00]

\definecolorgroup
  [red*]
  [1.00:0.95:0.95,
   1.00:0.90:0.90,
   1.00:0.80:0.80,
   1.00:0.70:0.70,
   1.00:0.60:0.60,
   1.00:0.50:0.50,
   1.00:0.40:0.40,
   1.00:0.30:0.30]

\definecolorgroup
  [green*]
  [0.95:1.00:0.95,
   0.90:1.00:0.90,
   0.80:1.00:0.80,
   0.70:1.00:0.70,
   0.60:1.00:0.60,
   0.50:1.00:0.50,
   0.40:1.00:0.40,
   0.30:1.00:0.30]

\definecolorgroup
  [blue*]
  [0.95:0.95:1.00,
   0.90:0.90:1.00,
   0.80:0.80:1.00,
   0.70:0.70:1.00,
   0.60:0.60:1.00,
   0.50:0.50:1.00,
   0.40:0.40:1.00,
   0.30:0.30:1.00]

\definecolorgroup
  [yellow*]
  [1.00:1.00:0.10,
   1.00:1.00:0.00,
   0.90:0.90:0.00,
   0.80:0.80:0.00,
   0.70:0.70:0.00,
   0.60:0.60:0.00,
   0.50:0.50:0.00,
   0.40:0.40:0.00]

%D For the sake of implementing interface dependant color
%D groups we support colorgroup duplication.

\startinterface dutch
  \definecolorgroup [grijs]   [gray]
  \definecolorgroup [rood]    [red]
  \definecolorgroup [groen]   [green]
  \definecolorgroup [blauw]   [blue]
  \definecolorgroup [cyaan]   [cyan]
  \definecolorgroup [magenta] [magenta]
  \definecolorgroup [geel]    [yellow]
  \definecolorgroup [rood*]   [red*]
  \definecolorgroup [groen*]  [green*]
  \definecolorgroup [blauw*]  [blue*]
  \definecolorgroup [geel*]   [yellow*]
\stopinterface

\startinterface german
  \definecolorgroup [grau]    [gray]
  \definecolorgroup [rot]     [red]
  \definecolorgroup [gruen]   [green]
  \definecolorgroup [blau]    [blue]
  \definecolorgroup [cyan]    [cyan]
  \definecolorgroup [magenta] [magenta]
  \definecolorgroup [gelb]    [yellow]
  \definecolorgroup [rot*]    [red*]
  \definecolorgroup [gruen*]  [green*]
  \definecolorgroup [blau*]   [blue*]
  \definecolorgroup [gelb*]   [yellow*]
\stopinterface

\startinterface czech
  \definecolorgroup [seda]     [gray]
  \definecolorgroup [cervena]  [red]
  \definecolorgroup [zelena]   [green]
  \definecolorgroup [modra]    [blue]
  \definecolorgroup [azurova]  [cyan]
  \definecolorgroup [fialova]  [magenta]
  \definecolorgroup [zluta]    [yellow]
  \definecolorgroup [cervena*] [red*]
  \definecolorgroup [zelena*]  [green*]
  \definecolorgroup [modra*]   [blue*]
  \definecolorgroup [zluta*]   [yellow*]
\stopinterface

\startinterface italian
  \definecolorgroup [grigio]  [gray]
  \definecolorgroup [rosso]   [red]
  \definecolorgroup [verde]   [green]
  \definecolorgroup [blu]     [blue]
  \definecolorgroup [ciano]   [cyan]
  \definecolorgroup [azzurro] [cyan]
  \definecolorgroup [turchino][cyan]
  \definecolorgroup [magenta] [magenta]
  \definecolorgroup [cremisi] [magenta]
  \definecolorgroup [giallo]  [yellow]
  \definecolorgroup [rosso*]  [red*]
  \definecolorgroup [verde*]  [green*]
  \definecolorgroup [blu*]    [blue*]
  \definecolorgroup [giallo*] [yellow*]
\stopinterface

%D The next set of color palets is quite language independant.
%D These palets are meant as examples.

\definepalet
  [alfa]
  [     top=red:7,
     bottom=green:6,
         up=blue:5,
       down=cyan:4,
    strange=magenta:3,
      charm=yellow:2]

\definepalet
  [beta]
  [     top=red:7,
     bottom=green:5,
         up=blue:3,
       down=cyan:6,
    strange=magenta:2,
      charm=yellow:1]

\definepalet
  [gamma]
  [     top=red:2,
     bottom=green:5,
         up=blue:3,
       down=cyan:6,
    strange=magenta:7,
      charm=yellow:4]

\definepalet
  [delta]
  [     top=yellow*:5,
     bottom=yellow*:3,
         up=yellow*:2,
       down=magenta:6,
    strange=blue:4,
      charm=blue:1]

\definepalet
  [epsilon]
  [     top=cyan:7,
     bottom=cyan:5,
         up=blue:3,
       down=yellow:6,
    strange=yellow:4,
      charm=yellow:2]

\definepalet
  [zeta]
  [     top=red:6,
     bottom=green:5,
         up=blue:7,
       down=cyan:4,
    strange=magenta:3,
      charm=yellow:2]

%D The next four colors are used for typesetting verbatim \TEX\
%D in color.

\definecolor [texcolorone]   [middlered]
\definecolor [texcolortwo]   [middlegreen]
\definecolor [texcolorthree] [middleblue]
\definecolor [texcolorfour]  [darkyellow]

%D Bonus (needed for FO test): 

\definecolor [orange]        [r=1,g=.5]

\endinput