Update dot size and color in welcome.css and add color preview in welcome.html

This commit is contained in:
Mauro Balades
2024-07-05 10:04:23 +02:00
parent f03aa78fde
commit 2268515bb1
3 changed files with 20 additions and 5 deletions

View File

@@ -190,16 +190,16 @@ input[type='checkbox'] {
}
.dot {
width: 7px;
height: 7px;
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--in-content-primary-button-background);
transition: all .1s;
background: light-dark(#000, #fff);
cursor: pointer;
}
.dot.active {
background: light-dark(#000, #fff);
background: var(--zen-primary-color);
}
#colorList {
@@ -224,3 +224,14 @@ input[type='checkbox'] {
width: 500px;
height: 20px;
}
#colorPreview {
margin-left: 10px;
border-radius: 5px;
width: 25px;
height: 25px;
position: absolute;
top: 50%;
right: -60px;
transform: translateY(-50%);
}

View File

@@ -77,6 +77,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
<div id="colorListWrapper">
<canvas id="colorList" class="cardGroup"></canvas>
<div id="dragBall"></div>
<div id="colorPreview"></div>
</div>
<button
id="themeNext"

View File

@@ -196,12 +196,15 @@ class Themes extends Page {
x = rect.width - 17 - (17/2);
}
const data = ctx.getImageData(x - 17, 1, 1, 1).data;
Services.prefs.setStringPref('zen.theme.accent-color', `#${data[0].toString(16)}${data[1].toString(16)}${data[2].toString(16)}`);
let color = `#${data[0].toString(16)}${data[1].toString(16)}${data[2].toString(16)}`;
document.getElementById("colorPreview").style.backgroundColor = color;
Services.prefs.setStringPref('zen.theme.accent-color', color);
}
const onMouseUp = () => {
document.removeEventListener('mousemove', onMouseMove);
document.removeEventListener('mouseup', onMouseUp);
document.getElementById("colorPreview").style.backgroundColor = '';
}
document.addEventListener('mousemove', onMouseMove);