-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Existed APIs
Type Color
(spx v1)
alias for image/color.RGBA
type RGBA struct {
R, G, B, A uint8
}
func (c RGBA) RGBA() (r, g, b, a uint32)
Utils (spx v1)
RGB(r, g, b uint8) Color
RGBA(r, g, b, a uint8) Color
Touching (spx v1)
TouchingColor(color Color) bool
Pen (Scratch < v3)
Set Pen Color to (value)
: value in range [0, 200]Change Pen Color by (delta)
Set Pen Shade to (value)
: value in range [0, 200]Change Pen Shade by (delta)
Pen (spx v1)
SetPenColor(color Color)
ChangePenColor(delta float64)
(not implemented)SetPenShade(shade float64)
ChangePenShade(delta float64)
SetPenHue(hue float64)
ChangePenHue(delta float64)
Pen (Scratch v3)
Set Pen Color to ()
Set Pen (color|saturation|brightness|ghost) to ()
: value in range [0, 100]Change Pen (color|saturation|brightness|ghost) by ()
Effects (Scratch v3)
Set (color|brightness|ghost) effect to ()
Change (color|brightness|ghost) effect by ()
- for
color
(hue), range [0, 200] is used - for
brightness
, range [-100, 100] is used - for
ghost
(transparency), range [0, 100] is used
- for
Proposal for spx v2
Use HSB instead of RGB as the main color model:
- When providing color picker in UI, use HSB
- When providing detailed-color-manipulation APIs, use HSB
- Provide utility functions to generate color value based on HSB value
Provide APIs as below:
Type Color
type Color struct {
// no exported fields or methods
}
Utils
func RGB(r, g, b uint8) Color
func RGBA(r, g, b, a uint8) Color
// h, s, b, a in range [0, 100], just like Scratch
func HSB(h, s, b float64) Color
func HSBA(h, s, b, a float64) Color
Touching
func TouchingColor(color Color) bool
Pen
type PenColorParam int
const (
PenHue PenColorParam = iota
PenSaturation
PenBrightness
)
func SetPenColor(color Color)
func SetPenColor(param PenColorParam, value float64)
func ChangePenColor(param PenColorParam, delta float64)
range [0, 100]
is used for hue
, saturation
, and brightness
Effects
type EffectKind int
const (
ColorEffect EffectKind = iota
BrightnessEffect
GhostEffect
// ...
)
func SetEffect(kind EffectKind, value float64)
func ChangeEffect(kind EffectKind, delta float64)
- for
color
(hue), range[0, 200]
is used - for
brightness
, range[-100, 100]
is used - for
ghost
(transparency), range[0, 100]
is used
Metadata
Metadata
Assignees
Labels
No labels