Stay organized with collections
Save and categorize content based on your preferences.
blockly > utils > colour > hexToRgb
utils.colour.hexToRgb() function
Converts a colour to RGB.
Signature:
export declare function hexToRgb(colour: string): number[];
Parameters
Parameter |
Type |
Description |
colour |
string |
String representing colour in any colour format ('#ff0000', 'red', '0xff000', etc). |
Returns:
number[]
RGB representation of the colour.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["The `utils.colour.hexToRgb()` function converts a color represented in any format (hex, name, etc.) to its RGB representation."],["It takes a single string argument representing the color and returns an array of three numbers representing the red, green, and blue values."]]],["The `hexToRgb` function, part of the `utils.colour` namespace, converts a color string into its RGB representation. It accepts a single parameter, `colour`, which is a string that can represent a color in various formats like '#ff0000', 'red', or '0xff000'. The function then returns an array of numbers, representing the RGB values of the provided color.\n"]]