From fde97e517bbc35602f2ef5d0e8f0722afecba2c3 Mon Sep 17 00:00:00 2001 From: ngradwohl Date: Sun, 28 Jul 2019 05:46:08 +0200 Subject: [PATCH] add functions for rgba and hsla color values --- desktop/sources/scripts/library.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 0d7c418..04d2f3b 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -115,6 +115,18 @@ function Library (ronin) { return rect } + // colors + + this.rgba = (r, g, b, a) => { // defines a color r, g, b values are from 0 to 255, a from 0 to 1 + return "rgba("+r+","+g+","+b+","+a+")"; + } + + + this.hsla = (h, s, l, a) => { // defines a color h from 0 to 360, s and l from 0 to 100, a from 0 to 1 + return "hsla("+h+","+s+"%,"+l+"%,"+a+")"; + } + + // Frame this.frame = () => { // Returns a rect of the frame.