From a081d5b0c852952919dcb1dc87a3aeae57a923c6 Mon Sep 17 00:00:00 2001 From: faiface Date: Sun, 9 Apr 2017 23:03:30 +0200 Subject: [PATCH] add RGB and Alpha functions --- color.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/color.go b/color.go index 46e6c30..94b2b65 100644 --- a/color.go +++ b/color.go @@ -9,6 +9,16 @@ type RGBA struct { R, G, B, A float64 } +// RGB returns a fully opaque RGBA color with the given RGB values. +func RGB(r, g, b float64) RGBA { + return RGBA{r, g, b, 1} +} + +// Alpha returns a while RGBA color with the given alpha component. +func Alpha(a float64) RGBA { + return RGBA{a, a, a, a} +} + // Add adds color d to color c component-wise and returns the result (the components are not // clamped). func (c RGBA) Add(d RGBA) RGBA {