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:
mr. m
2025-01-02 11:19:50 +01:00
committed by GitHub

View File

@@ -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');