Rebol 编程/request-color
外观
< Rebol 编程
REQUEST-COLOR /color clr /offset xy
请求颜色值。
REQUEST-COLOR 是一个函数值。
- /color
- clr -- (类型:任何)
- /offset
- xy -- (类型:任何)
request-color: func [ "Requests a color value." /color clr /offset xy /local result ][ if none? :color-lay [ color-lay: layout [ across origin 5x4 space 8x2 x: box 80x30 ibevel return t: field center middle 80 font-size 10 return pad 8 r: slider 16x278 gray red effect [gradient 0x1 255.0.0 0.0.0] [setc 1 r/data] g: slider 16x278 gray green effect [gradient 0x1 0.255.0 0.0.0] [setc 2 g/data] b: slider 16x278 gray blue effect [gradient 0x1 0.0.255 0.0.0] [setc 3 b/data] return pad 8 btn-enter "OK" 64 [result: x/color hide-popup] return pad 8 btn-cancel "None" escape 64 [hide-popup] ] ] x/color: either tuple? clr [clr] [0.0.0] r/data: 1 - (x/color/1 / 255) g/data: 1 - (x/color/2 / 255) b/data: 1 - (x/color/3 / 255) refresh either offset [inform/offset color-lay xy] [inform color-lay] result ]