mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-06 03:18:19 +00:00
Merge pull request #3738 from rachelkd/feature/prepend-hashtag-for-custom-colours-theme
Add feature: Prepend '#' to custom colours for themes if '#' is not included in hex code
This commit is contained in:
@@ -358,12 +358,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async addCustomColor() {
|
async addCustomColor() {
|
||||||
|
let color = this.customColorInput.value;
|
||||||
|
|
||||||
const color = this.customColorInput.value;
|
|
||||||
if (!color) {
|
if (!color) {
|
||||||
return;
|
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
|
// can be any color format, we just add it to the list as a dot, but hidden
|
||||||
const dot = document.createElement('div');
|
const dot = document.createElement('div');
|
||||||
dot.classList.add('zen-theme-picker-dot', 'hidden', 'custom');
|
dot.classList.add('zen-theme-picker-dot', 'hidden', 'custom');
|
||||||
|
Reference in New Issue
Block a user