mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +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() {
|
||||
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');
|
||||
dot.classList.add('zen-theme-picker-dot', 'hidden', 'custom');
|
||||
|
Reference in New Issue
Block a user