view 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 source

package models

type (
	Colour struct {
		R int     `json:"r"`
		G int     `json:"g"`
		B int     `json:"b"`
		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
}