diff --git a/src/app/components/generator/McdocRenderer.tsx b/src/app/components/generator/McdocRenderer.tsx index 249d9646..02788215 100644 --- a/src/app/components/generator/McdocRenderer.tsx +++ b/src/app/components/generator/McdocRenderer.tsx @@ -1,4 +1,5 @@ import * as core from '@spyglassmc/core' +import { ColorFormat } from '@spyglassmc/core' import type { JsonPairNode } from '@spyglassmc/json' import * as json from '@spyglassmc/json' import { JsonArrayNode, JsonBooleanNode, JsonNode, JsonNumberNode, JsonObjectNode, JsonStringNode } from '@spyglassmc/json' @@ -260,13 +261,23 @@ function EnumHead({ type, optional, excludeStrings, node, ctx }: Props onChangeValue((e.target as HTMLSelectElement).value)}> - {(value === undefined || optional) && } - {(value !== undefined && !type.values.map(v => v.value).includes(value)) && } - {type.values.filter(v => !excludeStrings?.includes(v.value.toString())).map(value => - - )} - + const color = type.attributes?.find(a => a.name === 'color')?.value + const colorKind = color?.kind === 'literal' && color.value.kind === 'string' ? color.value.value : undefined + const nodeColor = node?.color ? (Array.isArray(node.color) ? node.color : node.color.value ) : undefined + const inputColor = nodeColor ? core.ColorPresentation.fromColorFormat(ColorFormat.HexRGB, nodeColor, core.Range.create(0)).text : undefined + + return <> + + {colorKind === 'named' && nodeColor && <> + + } + } function NumericHead({ type, node, ctx }: Props) {