std/colour

Standard Library documentation

Colour parsing helpers.

Module

Name
std/colour
Area
Standard Library
Source
modules/std/colour.zzm

NAME

std/colour - Colour parsing helpers.

SYNOPSIS

  from std/colour import parse_colour;

  say( parse_colour("red") );  # #ff0000
  say( parse_colour("#abc") ); # #aabbcc

IMPLEMENTATION SUPPORT

This module is supported by all implementations of ZuzuScript.

DESCRIPTION

parse_colour accepts three- and six-digit hexadecimal colours and the CSS3 extended colour keywords. It returns a lowercase six-digit hexadecimal colour string.

EXPORTS

Functions

  • parse_colour(String x)

    Parameters: x is a CSS colour keyword or a three- or six-digit hexadecimal colour string. Returns: String. Returns the normalized lowercase #rrggbb colour string, or throws if x is not recognised.

COPYRIGHT AND LICENCE

std/colour is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.