Mercurial > gemma
diff pkg/models/system.go @ 846:6902032757e4
Added end point to set style (colour) information for feature.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Fri, 28 Sep 2018 11:51:06 +0200 |
parents | 0f61bfc21041 |
children | fcb38cedc680 |
line wrap: on
line diff
--- a/pkg/models/system.go Fri Sep 28 11:48:57 2018 +0200 +++ b/pkg/models/system.go Fri Sep 28 11:51:06 2018 +0200 @@ -8,3 +8,14 @@ A float32 `json:"a"` } ) + +func isByteRange(i int) bool { + return i >= 0 && i < 256 +} + +func (c Colour) IsValid() bool { + return isByteRange(c.R) && + isByteRange(c.G) && + isByteRange(c.B) && + c.A >= 0 && c.A <= 1 +}