Skip to main content
Module

x/carol/color.ts>Color

A Deno port of carlo
Go to Latest
class Color
import { Color } from "https://deno.land/x/carol@v1.0.0/color.ts";

Adopted from https://github.com/GoogleChromeLabs/carlo/blob/8f2cbfedf381818792017fe53651fe07f270bb96/lib/color.js which is licensed as follows:

Copyright 2018 Google Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Constructors

new
Color(
_rgba: Array<number>,
_format: string,
_originalText: string | null,
)

Properties

private
optional
_hsla: Array<number>
readonly
_originalTextIsValid: boolean

Methods

asString(format: string): string | null
canonicalRGBA(): Array<number>
detectHEXFormat(): string
format(): string
hasAlpha(): boolean
hsla(): Array<number>
rgba(): Array<number>

Static Properties

Format
Regex: RegExp

Static Methods

private
_parseHueNumeric(value: string): number | null
private
_parsePercentOrNumber(value: string): number | null
private
_parseRgbNumeric(value: string): number | null
private
_parseSatLightNumeric(value: string): number | null
_parseAlphaNumeric(value: string): number | null
hsl2rgb(hsl: Array<number>, outRgb: Array<number>): void
parse(text: string): Color | null