clear bookmark rainbow

This commit is contained in:
zombieFox 2021-08-21 09:19:10 +01:00
parent 57d3c4b0c6
commit aa28092090
3 changed files with 53 additions and 16 deletions

View File

@ -386,7 +386,7 @@ export const BookmarkForm = function({
id: 'accent',
labelText: 'Accent',
srOnly: true,
defaultValue: JSON.parse(JSON.stringify(bookmarkDefault.accent.rgb)),
defaultValue: bookmarkDefault.accent.rgb,
minMaxObject: bookmarkMinMax,
action: () => {
this.preview.update.style(bookmarkData);
@ -414,7 +414,7 @@ export const BookmarkForm = function({
id: 'color',
labelText: 'Colour',
srOnly: true,
defaultValue: JSON.parse(JSON.stringify(bookmarkDefault.color.rgb)),
defaultValue: bookmarkDefault.color.rgb,
minMaxObject: bookmarkMinMax,
action: () => {
this.preview.update.style(bookmarkData);

View File

@ -1940,18 +1940,27 @@ themeSetting.bookmark = (parent) => {
text: ['Bookmark border can also be changed when editing individual Bookmarks.', 'The colour of the Border is defined by the Accent which can also be changed when editing individual Bookmarks.']
});
themeSetting.control.bookmark.item.rainbow = new Button({
text: 'Apply unique accent to each',
themeSetting.control.bookmark.item.rainbow = {
add: new Button({
text: 'Add unique accent to each',
style: ['line'],
func: () => {
theme.accent.rainbow.render();
data.save();
}
});
themeSetting.control.bookmark.item.rainbowHelper = new Control_helperText({
}),
remove: new Button({
text: 'Remove all unique accent',
style: ['line'],
func: () => {
theme.accent.rainbow.clear();
data.save();
}
}),
helper: new Control_helperText({
text: ['Bookmark custom Accent can also be changed when editing individual Bookmarks.']
});
})
};
parent.appendChild(
node('div', [
@ -1969,8 +1978,20 @@ themeSetting.bookmark = (parent) => {
themeSetting.control.bookmark.item.border.wrap(),
themeSetting.control.bookmark.item.borderHelper.wrap(),
node('hr'),
themeSetting.control.bookmark.item.rainbow.wrap(),
themeSetting.control.bookmark.item.rainbowHelper.wrap()
form.wrap({
children: [
form.inline({
gap: 'small',
wrap: true,
equalGap: true,
children: [
themeSetting.control.bookmark.item.rainbow.add.wrap(),
themeSetting.control.bookmark.item.rainbow.remove.wrap(),
]
})
]
}),
themeSetting.control.bookmark.item.rainbow.helper.wrap()
])
);

View File

@ -3,6 +3,7 @@ import { data } from '../data';
import { appName } from '../appName';
import { toolbar } from '../toolbar';
import { bookmark } from '../bookmark';
import { bookmarkDefault } from '../bookmarkDefault';
import { groupAndBookmark } from '../groupAndBookmark';
import { themeSetting } from '../menuContent/themeSetting';
@ -201,6 +202,21 @@ theme.accent.rainbow = {
groupAndBookmark.render();
},
clear: () => {
bookmark.all.forEach((item, i) => {
item.items.forEach((item, i) => {
item.accent = JSON.parse(JSON.stringify(bookmarkDefault.accent));
});
});
groupAndBookmark.render();
}
};