Stay organized with collections
Save and categorize content based on your preferences.
blockly > utils > colour > blend
utils.colour.blend() function
Blend two colours together, using the specified factor to indicate the weight given to the first colour.
Signature:
export declare function blend(colour1: string, colour2: string, factor: number): string | null;
Parameters
Parameter |
Type |
Description |
colour1 |
string |
First colour. |
colour2 |
string |
Second colour. |
factor |
number |
The weight to be given to colour1 over colour2. Values should be in the range [0, 1]. |
Returns:
string | null
Combined colour represented in hex.
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."],[[["Blends two colors together, with an adjustable factor determining the influence of the first color on the final output."],["Accepts two color inputs as strings and a factor value between 0 and 1."],["Returns the combined color as a hexadecimal string or null if any input is invalid."],["Primarily used to create color transitions or variations based on a given weight."]]],[]]