mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Custom colors for tags
This commit is contained in:
@ -1806,7 +1806,7 @@
|
|||||||
|
|
||||||
<div class="select_chat_block_mes"></div>
|
<div class="select_chat_block_mes"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-container">
|
<div class="flex-container height100pSpaceEvenly">
|
||||||
<div class="renameChatButton fa-solid fa-pen"></div>
|
<div class="renameChatButton fa-solid fa-pen"></div>
|
||||||
<div file_name="" class="PastChat_cross fa-solid fa-circle-xmark"></div>
|
<div file_name="" class="PastChat_cross fa-solid fa-circle-xmark"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -1815,6 +1815,7 @@
|
|||||||
|
|
||||||
<div id="tag_view_template" class="template_element">
|
<div id="tag_view_template" class="template_element">
|
||||||
<div class="tag_view_item">
|
<div class="tag_view_item">
|
||||||
|
<div class="tagColorPickerHolder"></div>
|
||||||
<div class="tag_view_name" contenteditable="true"></div>
|
<div class="tag_view_name" contenteditable="true"></div>
|
||||||
<div class="tag_view_counter"><span class="tag_view_counter_value"></span> entries</div>
|
<div class="tag_view_counter"><span class="tag_view_counter_value"></span> entries</div>
|
||||||
<div title="Delete tag" class="tag_delete fa-solid fa-trash-can right_menu_button"></div>
|
<div title="Delete tag" class="tag_delete fa-solid fa-trash-can right_menu_button"></div>
|
||||||
|
@ -4313,7 +4313,11 @@ $(document).ready(function () {
|
|||||||
duration: 200,
|
duration: 200,
|
||||||
easing: animation_easing,
|
easing: animation_easing,
|
||||||
});
|
});
|
||||||
setTimeout(function () { $("#shadow_popup").css("display", "none"); }, 200);
|
setTimeout(function () {
|
||||||
|
$("#shadow_popup").css("display", "none");
|
||||||
|
$("#dialogue_popup").removeClass('large_dialogue_popup');
|
||||||
|
}, 200);
|
||||||
|
|
||||||
// $("#shadow_popup").css("opacity:", 0.0);
|
// $("#shadow_popup").css("opacity:", 0.0);
|
||||||
if (popup_type == "del_bg") {
|
if (popup_type == "del_bg") {
|
||||||
delBackground(bg_file_for_del.attr("bgfile"));
|
delBackground(bg_file_for_del.attr("bgfile"));
|
||||||
@ -4421,13 +4425,16 @@ $(document).ready(function () {
|
|||||||
if (popup_type == 'input') {
|
if (popup_type == 'input') {
|
||||||
dialogueResolve($("#dialogue_popup_input").val());
|
dialogueResolve($("#dialogue_popup_input").val());
|
||||||
$("#dialogue_popup_input").val('');
|
$("#dialogue_popup_input").val('');
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dialogueResolve(true);
|
dialogueResolve(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogueResolve = null;
|
dialogueResolve = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$("#dialogue_popup_cancel").click(function (e) {
|
$("#dialogue_popup_cancel").click(function (e) {
|
||||||
$("#shadow_popup").transition({
|
$("#shadow_popup").transition({
|
||||||
@ -4435,7 +4442,11 @@ $(document).ready(function () {
|
|||||||
duration: 200,
|
duration: 200,
|
||||||
easing: animation_easing,
|
easing: animation_easing,
|
||||||
});
|
});
|
||||||
setTimeout(function () { $("#shadow_popup").css("display", "none"); }, 200);
|
setTimeout(function () {
|
||||||
|
$("#shadow_popup").css("display", "none");
|
||||||
|
$("#dialogue_popup").removeClass('large_dialogue_popup');
|
||||||
|
}, 200);
|
||||||
|
|
||||||
//$("#shadow_popup").css("opacity:", 0.0);
|
//$("#shadow_popup").css("opacity:", 0.0);
|
||||||
popup_type = "";
|
popup_type = "";
|
||||||
|
|
||||||
@ -4443,6 +4454,7 @@ $(document).ready(function () {
|
|||||||
dialogueResolve(false);
|
dialogueResolve(false);
|
||||||
dialogueResolve = null;
|
dialogueResolve = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#add_bg_button").change(function () {
|
$("#add_bg_button").change(function () {
|
||||||
|
@ -153,6 +153,7 @@ function createNewTag(tagName) {
|
|||||||
const tag = {
|
const tag = {
|
||||||
id: random_id(),
|
id: random_id(),
|
||||||
name: tagName,
|
name: tagName,
|
||||||
|
color: '',
|
||||||
};
|
};
|
||||||
tags.push(tag);
|
tags.push(tag);
|
||||||
return tag;
|
return tag;
|
||||||
@ -165,6 +166,10 @@ function appendTagToList(listElement, tag, { removable, editable, selectable })
|
|||||||
|
|
||||||
let tagElement = $('#tag_template .tag').clone();
|
let tagElement = $('#tag_template .tag').clone();
|
||||||
tagElement.attr('id', tag.id);
|
tagElement.attr('id', tag.id);
|
||||||
|
|
||||||
|
tagElement.css('color', 'var(--SmartThemeBodyColor)');
|
||||||
|
tagElement.css('background-color', tag.color);
|
||||||
|
|
||||||
tagElement.find('.tag_name').text(tag.name);
|
tagElement.find('.tag_name').text(tag.name);
|
||||||
const removeButton = tagElement.find(".tag_remove");
|
const removeButton = tagElement.find(".tag_remove");
|
||||||
removable ? removeButton.show() : removeButton.hide();
|
removable ? removeButton.show() : removeButton.hide();
|
||||||
@ -287,21 +292,37 @@ function createTagInput(inputSelector, listSelector) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onViewTagsListClick() {
|
function onViewTagsListClick() {
|
||||||
|
$('#dialogue_popup').addClass('large_dialogue_popup');
|
||||||
const list = document.createElement('div');
|
const list = document.createElement('div');
|
||||||
const everything = Object.values(tag_map).flat();
|
const everything = Object.values(tag_map).flat();
|
||||||
$(list).append('<h3>Tags</h3><i>Click on the tag name to edit it.</i>')
|
$(list).append('<h3>Tags</h3><i>Click on the tag name to edit it.</i><br>');
|
||||||
|
$(list).append('<i>Click on color box to assign new color.</i><br><br>');
|
||||||
|
|
||||||
for (const tag of tags) {
|
for (const tag of tags) {
|
||||||
const count = everything.filter(x => x == tag.id).length;
|
const count = everything.filter(x => x == tag.id).length;
|
||||||
const template = $('#tag_view_template .tag_view_item').clone();
|
const template = $('#tag_view_template .tag_view_item').clone();
|
||||||
|
|
||||||
template.attr('id', tag.id);
|
template.attr('id', tag.id);
|
||||||
template.find('.tag_view_counter_value').text(count);
|
template.find('.tag_view_counter_value').text(count);
|
||||||
template.find('.tag_view_name').text(tag.name);
|
template.find('.tag_view_name').text(tag.name);
|
||||||
|
template.find('.tag_view_name').addClass('tag');
|
||||||
|
template.find('.tag_view_name').css('background-color', tag.color);
|
||||||
|
const colorPickerId = tag.name + "-tag-color";
|
||||||
|
template.find('.tagColorPickerHolder').html(
|
||||||
|
`<toolcool-color-picker id="${colorPickerId}" color="${tag.color}" class="tag-color"></toolcool-color-picker>`
|
||||||
|
);
|
||||||
|
|
||||||
|
template.find('.tag-color').attr('id', colorPickerId);
|
||||||
list.appendChild(template.get(0));
|
list.appendChild(template.get(0));
|
||||||
}
|
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
document.querySelector(`#${colorPickerId}`).addEventListener('change', (evt) => {
|
||||||
|
onTagColorize(evt);
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
$(colorPickerId).color = tag.color;
|
||||||
|
|
||||||
|
}
|
||||||
callPopup(list.outerHTML, 'text');
|
callPopup(list.outerHTML, 'text');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,6 +351,18 @@ function onTagRenameInput() {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onTagColorize(evt) {
|
||||||
|
console.log(evt);
|
||||||
|
const id = $(evt.target).closest('.tag_view_item').attr('id');
|
||||||
|
const newColor = evt.detail.rgba;
|
||||||
|
$(evt.target).parent().parent().find('.tag_view_name').css('background-color', newColor);
|
||||||
|
$(`.tag[id="${id}"]`).css('background-color', newColor);
|
||||||
|
const tag = tags.find(x => x.id === id);
|
||||||
|
tag.color = newColor;
|
||||||
|
console.log(tag);
|
||||||
|
saveSettingsDebounced();
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
createTagInput('#tagInput', '#tagList');
|
createTagInput('#tagInput', '#tagList');
|
||||||
createTagInput('#groupTagInput', '#groupTagList');
|
createTagInput('#groupTagInput', '#groupTagList');
|
||||||
|
@ -1355,6 +1355,7 @@ input[type=search]:focus::-webkit-search-cancel-button {
|
|||||||
|
|
||||||
#dialogue_popup {
|
#dialogue_popup {
|
||||||
width: 500px;
|
width: 500px;
|
||||||
|
max-width: 90svw;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
@ -1376,6 +1377,16 @@ input[type=search]:focus::-webkit-search-cancel-button {
|
|||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.large_dialogue_popup {
|
||||||
|
height: 90svh;
|
||||||
|
max-width: 90svw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.height100pSpaceEvenly {
|
||||||
|
align-content: space-evenly;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
#dialogue_popup_holder {
|
#dialogue_popup_holder {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -2438,7 +2449,7 @@ h5 {
|
|||||||
|
|
||||||
.tag_view_name {
|
.tag_view_name {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
flex: 2;
|
/* flex: 2; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag_view_counter {
|
.tag_view_counter {
|
||||||
@ -2448,6 +2459,7 @@ h5 {
|
|||||||
|
|
||||||
.tag_delete {
|
.tag_delete {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
|
color: var(--SmartThemeBodyColor) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
@ -2455,9 +2467,9 @@ h5 {
|
|||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
color: var(--SmartThemeQuoteColor);
|
color: var(--SmartThemeBodyColor);
|
||||||
background-color: var(--black30a);
|
background-color: var(--black30a);
|
||||||
border-color: var(--white30a);
|
border-color: var(--white50a);
|
||||||
padding: 0.2rem 0.3rem;
|
padding: 0.2rem 0.3rem;
|
||||||
font-size: calc(var(--mainFontSize) - 5%);
|
font-size: calc(var(--mainFontSize) - 5%);
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -2467,11 +2479,10 @@ h5 {
|
|||||||
width: fit-content;
|
width: fit-content;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
text-shadow: none !important;
|
text-shadow: none !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag.selected {
|
|
||||||
border-color: var(--white70a);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag_remove {
|
.tag_remove {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -2490,6 +2501,10 @@ h5 {
|
|||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#tagList .tag {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
.tags.tags_inline {
|
.tags.tags_inline {
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
column-gap: 0.2rem;
|
column-gap: 0.2rem;
|
||||||
@ -2517,6 +2532,13 @@ h5 {
|
|||||||
|
|
||||||
#rm_tag_filter .tag {
|
#rm_tag_filter .tag {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
opacity: 0.6;
|
||||||
|
filter: brightness(0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag.selected {
|
||||||
|
opacity: 1 !important;
|
||||||
|
filter: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
body .ui-autocomplete {
|
body .ui-autocomplete {
|
||||||
|
Reference in New Issue
Block a user