Skip to content

Commit f4c5423

Browse files
committed
Give different colors to types
1 parent a3e7068 commit f4c5423

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

src/components/schema/ColoredSyntax.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React from "react";
22

3-
export type ColoredSyntaxKind = "literal" | "interface";
3+
export type ColoredSyntaxKind = "literal" | "interface" | "container" | "atomic";
44

55
const syntaxStyles: Record<ColoredSyntaxKind, React.CSSProperties> = {
66
literal: { color: "var(--syntax-literal)" },
77
interface: { color: "var(--syntax-interface)" },
8+
container: { color: "var(--syntax-container)" },
9+
atomic: { color: "var(--syntax-atomic)" },
810
};
911

1012
export function ColoredSyntax({

src/components/schema/CrossGameRefs.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import React, { useContext } from "react";
22
import { styled } from "@linaria/react";
3-
import { Declaration, SchemaClass, SchemaEnum, SchemaFieldType, SchemaMetadataEntry } from "../../data/types";
3+
import {
4+
Declaration,
5+
SchemaClass,
6+
SchemaEnum,
7+
SchemaFieldType,
8+
SchemaMetadataEntry,
9+
} from "../../data/types";
410
import { DeclarationsContext, declarationPath } from "./DeclarationsContext";
511
import { GAMES, GameId } from "../../games";
612
import { SectionWrapper, SectionTitle, SectionList, SectionLink } from "./styles";

src/components/schema/ReferencedBy.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ import { useContext, useEffect, useState } from "react";
22
import { styled } from "@linaria/react";
33
import { DeclarationsContext, declarationKey, declarationPath } from "./DeclarationsContext";
44
import { KindIcon } from "../kind-icon/KindIcon";
5-
import {
6-
SectionWrapper,
7-
SectionTitle,
8-
SectionList,
9-
SectionLink,
10-
SectionToggle,
11-
} from "./styles";
5+
import { SectionWrapper, SectionTitle, SectionList, SectionLink, SectionToggle } from "./styles";
126

137
const COLLAPSE_THRESHOLD = 8;
148

src/components/schema/SchemaType.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function SchemaTypeView({ type }: { type: SchemaFieldType }) {
4545
if (type.inner) {
4646
return (
4747
<span>
48-
<ColoredSyntax kind="interface">{type.name}</ColoredSyntax>
48+
<ColoredSyntax kind="container">{type.name}</ColoredSyntax>
4949
<AngleBracket>&lt; </AngleBracket>
5050
<SchemaTypeView type={type.inner} />
5151
{type.inner2 && (
@@ -57,7 +57,7 @@ export function SchemaTypeView({ type }: { type: SchemaFieldType }) {
5757
</span>
5858
);
5959
}
60-
return <ColoredSyntax kind="interface">{type.name}</ColoredSyntax>;
60+
return <ColoredSyntax kind="atomic">{type.name}</ColoredSyntax>;
6161
case "bitfield":
6262
return <ColoredSyntax kind="literal">bitfield:{type.count}</ColoredSyntax>;
6363
}

src/global.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
--group-border: #e0e2e8;
1414
--search-highlight: #fef9c3;
1515

16-
--syntax-literal: #0e7555;
16+
--syntax-literal: #0550ae;
1717
--syntax-interface: #0e7555;
18+
--syntax-container: #7c5e10;
19+
--syntax-atomic: #8250af;
1820

1921
--scrollbar-track: transparent;
2022
--scrollbar-thumb: #cdd0d6;
@@ -38,8 +40,10 @@
3840
--group-border: #262930;
3941
--search-highlight: #6dbf3a20;
4042

41-
--syntax-literal: #5ee6b8;
43+
--syntax-literal: #79c0ff;
4244
--syntax-interface: #5ee6b8;
45+
--syntax-container: #e3b341;
46+
--syntax-atomic: #d2a8ff;
4347

4448
--scrollbar-track: transparent;
4549
--scrollbar-thumb: #363a42;

0 commit comments

Comments
 (0)