User Tools

Site Tools


en:color

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:color [2016/01/01 22:40]
127.0.0.1 external edit
en:color [2020/11/22 21:26] (current)
admin
Line 3: Line 3:
 ==== Format ==== ==== Format ====
  
-**color** //color_name//\\ +**color** color\\ 
-**color** ( //color_name// )\\ +**color** ( color )\\ 
-**color** //rgb_expr//\\ +**color** pen_colorbrush_color\\ 
-**color** ( //rgb_expr// )\\ +**color** ( pen_colorbrush_color )
-**color** //pen_color_name// , //brush_color_name//\\ +
-**color** ( //pen_color_name// , //brush_color_name// )\\ +
-**color** //pen_rgb_expr// //brush_rgb_expr//\\ +
-**color** ( //pen_rgb_expr// //brush_rgb_expr// )+
  
 ==== Description ==== ==== Description ====
  
-Sets the current drawing color to //colorname// or to an ARGB value where ( (a * 256 + r) * 256 + b) * 256 + g.  If a single color is specified both the pen and the brush will be set to the same color.+Sets the current drawing color to //colorname// or to an ARGB value where ((a * 256 + r) * 256 + g) * 256 + b.  If a single color is specified both the pen and the brush will be set to the same color.  There are several ways to define a color in BASIC256: 
 + 
 +  - one of the defined color constants (see table below); 
 +  - an integer to define the color where ((a * 256 + r) * 256 + g) * 256 + b, 
 +    * a - transparency 0 = transparent to 255 = opaque 
 +    * r - red 0 = off to 255 = full on 
 +    * g - green 0 = off to 255 = full on 
 +    * b - blue 0 = off to 255 = full on 
 +  - the [[rgb|rgb]] function passing it 3 or 4 numbers from 0-255, 
 +  - using an svg color name as a string [[https://www.w3.org/TR/SVG11/types.html#ColorKeywords|as defined by the W3C]], 
 +  - or using a string with a "#" followed by 6 or 8 hexadecimal digits ("#ff0000", "#a0ffffff"
  
 When drawing solid shapes ([[Chord|Chord]],[[Circle|Circle]],[[Pie|Pie]],[[Poly|Poly]],[[Rect|Rect]], and [[Stamp|Stamp]]) the border of the shape will be drawn with the pen color and the shape itself will be filled with the brush color.  A brush color of CLEAR is used to not fill a closed shape. When drawing solid shapes ([[Chord|Chord]],[[Circle|Circle]],[[Pie|Pie]],[[Poly|Poly]],[[Rect|Rect]], and [[Stamp|Stamp]]) the border of the shape will be drawn with the pen color and the shape itself will be filled with the brush color.  A brush color of CLEAR is used to not fill a closed shape.
Line 20: Line 27:
 If the current pen and brush are both set to CLEAR the pixels or shapes drawn will clear the pixels of the graphics output area and make them transparent.  This is especially useful when creating sprites using the Spriteslice command.\\ If the current pen and brush are both set to CLEAR the pixels or shapes drawn will clear the pixels of the graphics output area and make them transparent.  This is especially useful when creating sprites using the Spriteslice command.\\
  
-===Color names and RGB values=== +{{page>en:colorconstants}}
-^Color Name^ARGB Values^Integer^^ +
-|black|255, 0, 0, 0|4278190080|<hi #000000>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|white|255, 255, 255, 255|4294506744|<hi #FFFFFF>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|red|255, 255, 0, 0|4294901760|<hi #FF0000>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|darkred|255, 128, 0, 0|4286578688|<hi #800000>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|green|255, 0, 255, 0|4278255360|<hi #00FF00>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|darkgreen|255, 0, 128, 0|4278222848|<hi #008000>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|blue|255, 0, 0, 255|4278190335|<hi #0000FF>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|darkblue|255, 0, 0, 128|4278190208|<hi #000080>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|cyan|255, 0, 255, 255|4278255615|<hi #00FFFF>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|darkcyan|255, 0, 128, 128|4278222976|<hi #008080>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|purple|255, 255, 0, 255|4294902015|<hi #FF00FF>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|darkpurple|255, 128, 0, 128|4286578816|<hi #800080>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|yellow|255, 255, 255, 0|4294967040|<hi #FFFF00>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|darkyellow|255, 128, 128 ,0|4286611456|<hi #808000>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|orange|255, 255, 102, 0|4294927872|<hi #FF6600>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|darkorange|255, 176, 61 ,0|4289344256|<hi #B03D00>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|grey|255, 164, 164 ,164|4288980132|<hi #A4A4A4>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|darkgrey|255, 128, 128 ,128|4286611584|<hi #808080>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>+
-|clear|0, 0, 0, 0|0|~~SP~~|+
  
 ==== Deprecated Form ==== ==== Deprecated Form ====
Line 59: Line 46:
 color rgb(255,160,160) color rgb(255,160,160)
 circle 100,100,25 circle 100,100,25
 +
 +penwidth 5
 +color "firebrick","#fab856"
 +rect 150,150,100,100
 +
 +color "papayawhip", "clear"
 +rect 175,175,100,100
 </code> </code>
-Will draw a grey rectangle with a green circle filled with red and then a pink circle inside it.\\ +Will draw the following:\\ 
-{{:color.png|Color}}+{{:color2.png|Color}}
  
  
Line 72: Line 66:
 |0.9.9.28|Changed color values to include Alpha (transparency) and changed color constants to new ARGB values.| |0.9.9.28|Changed color values to include Alpha (transparency) and changed color constants to new ARGB values.|
 |0.9.9.45|changed values to positive numbers following formula as documented.| |0.9.9.45|changed values to positive numbers following formula as documented.|
 +|2.0.99.4|Added ability to use string names and hex values for colors.|
en/color.1451713241.txt.gz · Last modified: 2020/02/28 10:46 (external edit)