fix(ui): use distinct color palette for group tags
This commit is contained in:
parent
d4d395e178
commit
033365a118
@ -175,7 +175,7 @@ export const getModelCategories = (() => {
|
|||||||
model.model_name.toLowerCase().includes('text-embedding-004') ||
|
model.model_name.toLowerCase().includes('text-embedding-004') ||
|
||||||
model.model_name.toLowerCase().includes('imagen-4') ||
|
model.model_name.toLowerCase().includes('imagen-4') ||
|
||||||
model.model_name.toLowerCase().includes('veo-') ||
|
model.model_name.toLowerCase().includes('veo-') ||
|
||||||
model.model_name.toLowerCase().includes('aqa') ,
|
model.model_name.toLowerCase().includes('aqa'),
|
||||||
},
|
},
|
||||||
moonshot: {
|
moonshot: {
|
||||||
label: 'Moonshot',
|
label: 'Moonshot',
|
||||||
@ -602,6 +602,34 @@ export function stringToColor(str) {
|
|||||||
return colors[i];
|
return colors[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// High-contrast color palette for group tags (avoids similar blue/teal shades)
|
||||||
|
const groupColors = [
|
||||||
|
'red',
|
||||||
|
'orange',
|
||||||
|
'yellow',
|
||||||
|
'lime',
|
||||||
|
'green',
|
||||||
|
'cyan',
|
||||||
|
'blue',
|
||||||
|
'indigo',
|
||||||
|
'violet',
|
||||||
|
'purple',
|
||||||
|
'pink',
|
||||||
|
'amber',
|
||||||
|
'grey',
|
||||||
|
];
|
||||||
|
|
||||||
|
export function groupToColor(str) {
|
||||||
|
// Use a better hash algorithm for more even distribution
|
||||||
|
let hash = 0;
|
||||||
|
for (let i = 0; i < str.length; i++) {
|
||||||
|
hash = (hash << 5) - hash + str.charCodeAt(i);
|
||||||
|
hash = hash & hash;
|
||||||
|
}
|
||||||
|
hash = Math.abs(hash);
|
||||||
|
return groupColors[hash % groupColors.length];
|
||||||
|
}
|
||||||
|
|
||||||
// 渲染带有模型图标的标签
|
// 渲染带有模型图标的标签
|
||||||
export function renderModelTag(modelName, options = {}) {
|
export function renderModelTag(modelName, options = {}) {
|
||||||
const {
|
const {
|
||||||
@ -670,7 +698,7 @@ export function renderGroup(group) {
|
|||||||
<span key={group}>
|
<span key={group}>
|
||||||
{groups.map((group) => (
|
{groups.map((group) => (
|
||||||
<Tag
|
<Tag
|
||||||
color={tagColors[group] || stringToColor(group)}
|
color={tagColors[group] || groupToColor(group)}
|
||||||
key={group}
|
key={group}
|
||||||
shape='circle'
|
shape='circle'
|
||||||
onClick={async (event) => {
|
onClick={async (event) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user