Implemented: Restore default colors (#109)

This commit is contained in:
nobody 2020-09-25 16:18:08 +02:00
parent e9fd82a416
commit 95f4e0bd1b
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
3 changed files with 62 additions and 0 deletions

View File

@ -19,3 +19,7 @@ CC0
copy-dark.svg, copy-light.svg (edited)
https://www.svgrepo.com/svg/76619/copy
CC0
restore.svg
https://www.svgrepo.com/svg/53536/return
CC0

39
icons/restore.svg Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 47.707 47.707" style="enable-background:new 0 0 47.707 47.707;" xml:space="preserve">
<path d="M26.561,0h-24c-0.552,0-1,0.447-1,1s0.448,1,1,1h24c9.925,0,18,8.075,18,18s-8.075,18-18,18H4.975l6.293-6.293l-1.414-1.414
l-7.999,7.999c-0.001,0.001-0.001,0.001-0.002,0.002L1.146,39l0.706,0.706c0.001,0.001,0.001,0.001,0.002,0.002l7.999,7.999
l1.414-1.414L4.975,40h21.586c11.028,0,20-8.972,20-20S37.588,0,26.561,0z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 971 B

View File

@ -139,6 +139,9 @@ options._renderOptionsPanel = function () {
document.getElementById('export-data').addEventListener('click', storageManager.export);
document.getElementById('import-data').addEventListener('click', storageManager.startImportFilePicker);
document.getElementById('import-file-picker').addEventListener('change', storageManager.handleImportFilePicker);
document.getElementById('restore-background-color').addEventListener('click', options._setDefaultColor);
document.getElementById('restore-text-color').addEventListener('click', options._setDefaultColor);
};
options._renderBlockMissingNotice = function () {
@ -382,6 +385,22 @@ options._colorPicker = function () {
});
};
options._setDefaultColor = function ({ target }) {
if (target.id === 'restore-text-color') {
options._textColor = '#FFFFFF';
wrappers.setBadgeTextColor({color: options._textColor});
document.getElementById('counter-preview-badge').style.color = options._textColor;
document.getElementById('pre-badged-text-color').style.backgroundColor = options._textColor;
document.getElementById('badged-text-color').value = options._textColor;
} else if (target.id === 'restore-background-color') {
options._backgroundColor = '#4A826C';
wrappers.setBadgeBackgroundColor({color: options._backgroundColor});
document.getElementById('counter-preview-badge').style.backgroundColor = options._backgroundColor;
document.getElementById('pre-badged-background-color').style.backgroundColor = options._backgroundColor;
document.getElementById('badged-background-color').value = options._backgroundColor;
}
};
/**
* Event Handlers