Navigation
Synopsis The color gray.
Function
  1. Color gray(int g)
  2. Color gray(int g, real alpha)
  3. Color gray(real perc)
  4. Color gray(real perc, real alpha)
Description Create gray colors in various shades:
  1. Create a gray color between black (0) and white (255).
  2. Create a gray color between black (0) and white (255) with transparency alpha.
  3. Create a gray color between black (0.0) and white (1.0).
  4. Create a gray color between black (0.0) and white (1.0) transparency alpha.
Examples Setting gray values with an integer in the range [0,255]:
b1 = box(fillColor(gray(0)));
b2 = box(fillColor(gray(125)));
b3 = box(fillColor(gray(255)));
render(hcat([b1, b2, b3], size(50)));
gives: h1

Setting gray values with an a percentage in the range [0.0, 1.0]:
b1 = box(fillColor(gray(0.0)));
b2 = box(fillColor(gray(0.5)));
b3 = box(fillColor(gray(1.0)));
render(hcat([b1, b2, b3], size(50)));
gives: h2

Setting transparency:
b1 = box(fillColor(gray(0.5, 0.0)));
b2 = box(fillColor(gray(0.5, 0.5)));
b3 = box(fillColor(gray(0.5, 1.0)));
render(hcat([b1, b2, b3], size(50)));
gives: h3
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.