()
| 159 | type dec float64 |
| 160 | |
| 161 | func (f dec) String() string { |
| 162 | s := fmt.Sprintf("%.*f", Precision, f) |
| 163 | s = string(minify.Decimal([]byte(s), Precision)) |
| 164 | if dec(math.MaxInt32) < f || f < dec(math.MinInt32) { |
| 165 | if i := strings.IndexByte(s, '.'); i == -1 { |
| 166 | s += ".0" |
| 167 | } |
| 168 | } |
| 169 | return s |
| 170 | } |
| 171 | |
| 172 | // CSSColor is a string formatter to convert a color.RGBA to a CSS color (hexadecimal or using rgba()). |
| 173 | type CSSColor color.RGBA |