Skip to content

Commit

Permalink
Rename _colorToRgbArray for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb531 committed Jun 9, 2024
1 parent c71921e commit c3b6422
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/jcanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@ function _normalizeColor(color: string) {
}

// Convert a color value to an array of RGB values
function _colorToRgbArray(color: string) {
function _convertColorToRgbArray(color: string) {
const normalizedColor: string = _normalizeColor(color);
// Parse RGB string
if (/^rgb/gi.test(normalizedColor)) {
Expand All @@ -2011,8 +2011,8 @@ function _colorToRgbArray(color: string) {

// Blend two colors by the given percentage
function _blendColors(color1: string, color2: string, percentage: number) {
const [r1, g1, b1, a1] = _colorToRgbArray(color1);
const [r2, g2, b2, a2] = _colorToRgbArray(color2);
const [r1, g1, b1, a1] = _convertColorToRgbArray(color1);
const [r2, g2, b2, a2] = _convertColorToRgbArray(color2);

const r = round(r1 + (r2 - r1) * percentage);
const g = round(g1 + (g2 - g1) * percentage);
Expand Down

0 comments on commit c3b6422

Please sign in to comment.