Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] %rgbcolors.r

From: rchristiansen::pop::isdfa::sei-it::com at: 1-Aug-2000 17:02

Following is an RGB Color Selector I created using /View. It is my first /View creation and I'm pretty happy with it except for a couple of quirks (which are explained in the "Comments" portion of the header. I have it here if you would like to use it in determining colors for your /View scripts or HTML pages. If you can help me fix the couple of problems with the script, I would be grateful. Thanks. -Ryan REBOL [ Title: "RGB Color Selector" Date: 1-August-2000 Version: 0.9.0 File: %rgbcolors.r Author: "Ryan C. Christiansen" Email: [norsepower--uswest--net] Owner: "Ryan C. Christiansen" Rights: "Copyright (C) Ryan C. Christiansen 2000" Tabs: 4 Language: 'English Purpose: { Interpolates and displays RGB color values in tuple and in hexidecimal based on red, green, and blue sliders. } Comment: { The author is no mathematician and still has not figured out how to make the tuple range from 0.0.0 to 255.255.255 instead of 1.1.1 to 255.255.255. Also, the hex values returned have a similar problem, whereas #010101 is the darkest value instead of #000000. Also, you must slide all color bars from their original position before clicking on a color frame or else the script will return an error. } History: [ 0.9.0 [1-August-2000 "Created this example" "Ryan"] ] Example: {Slide the red, green, and blue sliders and then click on the frames to view the color created and the tuple and hex values for the color.} ] rgb-color-selector: layout/size [ backdrop 255.255.255 rgb-tuple: frame 105x50 [ rgb-tuple/color: make tuple! rejoin [red/data {.} green/data {.} blue/data] rgb-tuple/text: make string! rejoin [red/data {.} green/data {.} blue/data] show rgb-tuple ] rgb-hex: frame 105x50 [ rgb-hex/color: make tuple! rejoin [red/data {.} green/data {.} blue/data] red-hex: to-hex red/data green-hex: to-hex green/data blue-hex: to-hex blue/data rgb-hex/text: make string! rejoin [{#} red-hex/7 red-hex/8 green-hex/7 green-hex/8 blue-hex/7 blue-hex/8] show rgb-hex ] across red: slider 30x259 [ red/color: 255.0.0 + (255 - red/data) show red print red/data ] green: slider 30x259 [ green/color: 0.255.0 + (255 - green/data) show green ] blue: slider 30x259 [ blue/color: 0.0.255 + (255 - blue/data) show blue ] return button 105x25 "close" [unview/only rgb-color-selector] ] 144x450 view rgb-color-selector