returning a pointer is not necessary
This commit is contained in:
parent
4b6f159d03
commit
bdcb20acb2
7
color.go
7
color.go
@ -77,12 +77,13 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewRGBColor(r, g, b uint8) (*RGBColor, error) {
|
func NewRGBColor(r, g, b uint8) (RGBColor, error) {
|
||||||
|
var c RGBColor
|
||||||
if (r < 0 || r > 255) && (g < 0 || r > 255) && (b < 0 || b > 255) {
|
if (r < 0 || r > 255) && (g < 0 || r > 255) && (b < 0 || b > 255) {
|
||||||
return nil, errors.New("values must be between 0-255")
|
return c, errors.New("values must be between 0-255")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &RGBColor{R: r, G: g, B: b}, nil
|
return RGBColor{R: r, G: g, B: b}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHSColor(h, s float32) (HSBKColor, error) {
|
func NewHSColor(h, s float32) (HSBKColor, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user