fixed bugs in tags editing

This commit is contained in:
or-else
2021-08-18 19:51:19 -07:00
parent 529486feb3
commit 2cc2258682
12 changed files with 211 additions and 88 deletions
+6 -2
View File
@@ -50,6 +50,10 @@ function stringToColorHash(value) {
}
// Converts user or topic ID to a CSS color class. Ideally it should produce the same color value as Java version.
export function idToColorClass(string, light) {
return (light ? 'light-color' : 'dark-color') + (Math.abs(stringToColorHash(string)) % 16);
// params:
// - {string} id: user or topic ID
// - {boolean} light: light or dark version of the color.
// - {boolean} fg: foreground or background color.
export function idToColorClass(id, light, fg) {
return (light ? 'lt-' : 'dk-') + (fg ? 'fg-' : 'bg-') + (Math.abs(stringToColorHash(id)) % 16);
}