Skip to content

Commit

Permalink
Add feature: Prepend '#' to custom colours for themes
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelkd committed Dec 14, 2024
1 parent a9fb598 commit 7010945
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/browser/base/zen-components/ZenGradientGenerator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -363,13 +363,16 @@
}

async addCustomColor() {
let color = this.customColorInput.value;

const color = this.customColorInput.value;
if (!color) {

return;
}

// Add '#' prefix if it's missing and the input appears to be a hex color
if (!color.startsWith('#') && /^[0-9A-Fa-f]{3,6}$/.test(color)) {
color = '#' + color;
}

// can be any color format, we just add it to the list as a dot, but hidden
const dot = document.createElement('div');
Expand Down

0 comments on commit 7010945

Please sign in to comment.