Update color
This commit is contained in:
@@ -17,13 +17,13 @@ const TYPE_SYNONYMS: Record<string, string> = {
|
|||||||
'unknown': 'unknown',
|
'unknown': 'unknown',
|
||||||
'未知': 'unknown',
|
'未知': 'unknown',
|
||||||
'other': 'unknown',
|
'other': 'unknown',
|
||||||
|
|
||||||
// category 类型及其同义词
|
// category 类型及其同义词
|
||||||
'category': 'category',
|
'category': 'category',
|
||||||
'类别': 'category',
|
'类别': 'category',
|
||||||
'type': 'category',
|
'type': 'category',
|
||||||
'分类': 'category',
|
'分类': 'category',
|
||||||
|
|
||||||
// organization 类型及其同义词
|
// organization 类型及其同义词
|
||||||
'organization': 'organization',
|
'organization': 'organization',
|
||||||
'组织': 'organization',
|
'组织': 'organization',
|
||||||
@@ -31,32 +31,32 @@ const TYPE_SYNONYMS: Record<string, string> = {
|
|||||||
'company': 'organization',
|
'company': 'organization',
|
||||||
'公司': 'organization',
|
'公司': 'organization',
|
||||||
'机构': 'organization',
|
'机构': 'organization',
|
||||||
|
|
||||||
// event 类型及其同义词
|
// event 类型及其同义词
|
||||||
'event': 'event',
|
'event': 'event',
|
||||||
'事件': 'event',
|
'事件': 'event',
|
||||||
'activity': 'event',
|
'activity': 'event',
|
||||||
'活动': 'event',
|
'活动': 'event',
|
||||||
|
|
||||||
// person 类型及其同义词
|
// person 类型及其同义词
|
||||||
'person': 'person',
|
'person': 'person',
|
||||||
'人物': 'person',
|
'人物': 'person',
|
||||||
'people': 'person',
|
'people': 'person',
|
||||||
'human': 'person',
|
'human': 'person',
|
||||||
'人': 'person',
|
'人': 'person',
|
||||||
|
|
||||||
// animal 类型及其同义词
|
// animal 类型及其同义词
|
||||||
'animal': 'animal',
|
'animal': 'animal',
|
||||||
'动物': 'animal',
|
'动物': 'animal',
|
||||||
'creature': 'animal',
|
'creature': 'animal',
|
||||||
'生物': 'animal',
|
'生物': 'animal',
|
||||||
|
|
||||||
// geo 类型及其同义词
|
// geo 类型及其同义词
|
||||||
'geo': 'geo',
|
'geo': 'geo',
|
||||||
'地理': 'geo',
|
'地理': 'geo',
|
||||||
'geography': 'geo',
|
'geography': 'geo',
|
||||||
'地域': 'geo',
|
'地域': 'geo',
|
||||||
|
|
||||||
// location 类型及其同义词
|
// location 类型及其同义词
|
||||||
'location': 'location',
|
'location': 'location',
|
||||||
'地点': 'location',
|
'地点': 'location',
|
||||||
@@ -64,19 +64,19 @@ const TYPE_SYNONYMS: Record<string, string> = {
|
|||||||
'address': 'location',
|
'address': 'location',
|
||||||
'位置': 'location',
|
'位置': 'location',
|
||||||
'地址': 'location',
|
'地址': 'location',
|
||||||
|
|
||||||
// technology 类型及其同义词
|
// technology 类型及其同义词
|
||||||
'technology': 'technology',
|
'technology': 'technology',
|
||||||
'技术': 'technology',
|
'技术': 'technology',
|
||||||
'tech': 'technology',
|
'tech': 'technology',
|
||||||
'科技': 'technology',
|
'科技': 'technology',
|
||||||
|
|
||||||
// equipment 类型及其同义词
|
// equipment 类型及其同义词
|
||||||
'equipment': 'equipment',
|
'equipment': 'equipment',
|
||||||
'设备': 'equipment',
|
'设备': 'equipment',
|
||||||
'device': 'equipment',
|
'device': 'equipment',
|
||||||
'装备': 'equipment',
|
'装备': 'equipment',
|
||||||
|
|
||||||
// weapon 类型及其同义词
|
// weapon 类型及其同义词
|
||||||
'weapon': 'weapon',
|
'weapon': 'weapon',
|
||||||
'武器': 'weapon',
|
'武器': 'weapon',
|
||||||
@@ -96,12 +96,12 @@ const NODE_TYPE_COLORS: Record<string, string> = {
|
|||||||
'location': '#cf6d17', // Carrot
|
'location': '#cf6d17', // Carrot
|
||||||
'technology': '#b300b3', // Purple
|
'technology': '#b300b3', // Purple
|
||||||
'equipment': '#2F4F4F', // DarkSlateGray
|
'equipment': '#2F4F4F', // DarkSlateGray
|
||||||
'weapon': '#0f558a', // NavyBlue
|
'weapon': '#4421af', // DeepPurple
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extended colors pool - Used for unknown node types
|
// Extended colors pool - Used for unknown node types
|
||||||
const EXTENDED_COLORS = [
|
const EXTENDED_COLORS = [
|
||||||
'#4421af', // DeepPurple
|
'#0f558a', // NavyBlue
|
||||||
'#cd071e', // ChinaRed
|
'#cd071e', // ChinaRed
|
||||||
'#5a2c6d', // DeepViolet
|
'#5a2c6d', // DeepViolet
|
||||||
'#0000ff', // Blue
|
'#0000ff', // Blue
|
||||||
@@ -117,7 +117,7 @@ const EXTENDED_COLORS = [
|
|||||||
|
|
||||||
// Select color based on node type
|
// Select color based on node type
|
||||||
const getNodeColorByType = (nodeType: string | undefined): string => {
|
const getNodeColorByType = (nodeType: string | undefined): string => {
|
||||||
|
|
||||||
const defaultColor = '#5D6D7E';
|
const defaultColor = '#5D6D7E';
|
||||||
|
|
||||||
const normalizedType = nodeType ? nodeType.toLowerCase() : 'unknown';
|
const normalizedType = nodeType ? nodeType.toLowerCase() : 'unknown';
|
||||||
@@ -145,11 +145,11 @@ const getNodeColorByType = (nodeType: string | undefined): string => {
|
|||||||
.filter(([, color]) => !Object.values(NODE_TYPE_COLORS).includes(color))
|
.filter(([, color]) => !Object.values(NODE_TYPE_COLORS).includes(color))
|
||||||
.map(([, color]) => color)
|
.map(([, color]) => color)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Find and use the first unused extended color
|
// Find and use the first unused extended color
|
||||||
const unusedColor = EXTENDED_COLORS.find(color => !usedExtendedColors.has(color));
|
const unusedColor = EXTENDED_COLORS.find(color => !usedExtendedColors.has(color));
|
||||||
const newColor = unusedColor || defaultColor;
|
const newColor = unusedColor || defaultColor;
|
||||||
|
|
||||||
// Update color mapping
|
// Update color mapping
|
||||||
const newMap = new Map(typeColorMap);
|
const newMap = new Map(typeColorMap);
|
||||||
newMap.set(normalizedType, newColor);
|
newMap.set(normalizedType, newColor);
|
||||||
|
Reference in New Issue
Block a user