]> git.r.bdr.sh - rbdr/map/blob - Map/MapColor.swift
Fix performance and undo
[rbdr/map] / Map / MapColor.swift
1 import SwiftUI
2
3 struct MapColor {
4 let foreground: Color
5 let background: Color
6 let secondary: Color
7 let blocker: Color
8 let opportunity: Color
9 let stages: StageColor
10 let syntax: SyntaxColor
11
12 static func colorForScheme(_ colorScheme: ColorScheme) -> MapColor {
13 if colorScheme == .dark {
14 return MapColor(
15 foreground: Color.white,
16 background: Color(.sRGB, red: 0.13, green: 0.13, blue: 0.13),
17 secondary: Color(.sRGB, red: 0.81, green: 0.78, blue: 0.79),
18 blocker: Color(.sRGB, red: 0.13, green: 0.13, blue: 0.13),
19 opportunity: Color(.sRGB, red: 1.0, green: 0.37, blue: 0.34),
20 stages: StageColor(
21 i: Color(.sRGB, red: 0.37, green: 0.16, blue: 0.25),
22 ii: Color(.sRGB, red: 0.30, green: 0.29, blue: 0.26),
23 iii: Color(.sRGB, red: 0.15, green: 0.29, blue: 0.23),
24 iv: Color(.sRGB, red: 0.14, green: 0.22, blue: 0.31)),
25 syntax: SyntaxColor(
26 vertex: NSColor(srgbRed: 0.41, green: 0.84, blue: 0.96, alpha: 1.0),
27 number: NSColor(srgbRed: 0.85, green: 0.78, blue: 0.49, alpha: 1.0),
28 option: NSColor(srgbRed: 1.0, green: 0.48, blue: 0.7, alpha: 1.0), // #FE7AB3
29 symbol: NSColor(srgbRed: 0.85, green: 0.73, blue: 1.0, alpha: 1.0) // #DABBFF
30 ))
31 } else {
32 return MapColor(
33 foreground: Color(.sRGB, red: 0.13, green: 0.13, blue: 0.13),
34 background: Color.white,
35 secondary: Color.gray,
36 blocker: Color(.sRGB, red: 0.60, green: 0.52, blue: 0.51),
37 opportunity: Color(.sRGB, red: 1.0, green: 0.37, blue: 0.34),
38 stages: StageColor(
39 i: Color(.sRGB, red: 1.00, green: 0.93, blue: 0.97),
40 ii: Color(.sRGB, red: 1.00, green: 0.98, blue: 0.92),
41 iii: Color(.sRGB, red: 0.93, green: 1.00, blue: 0.97),
42 iv: Color(.sRGB, red: 0.93, green: 0.96, blue: 1.00)),
43 syntax: SyntaxColor(
44 vertex: NSColor(srgbRed: 0.11, green: 0.42, blue: 0.57, alpha: 1.0),
45 number: NSColor(srgbRed: 0.27, green: 0.31, blue: 0.87, alpha: 1.0),
46 option: NSColor(srgbRed: 0.68, green: 0.24, blue: 0.64, alpha: 1.0),
47 symbol: NSColor(srgbRed: 0.29, green: 0.13, blue: 0.69, alpha: 1.0)
48 ))
49 }
50 }
51 }
52
53 struct StageColor {
54 let i: Color
55 let ii: Color
56 let iii: Color
57 let iv: Color
58 }
59
60 struct SyntaxColor {
61 let vertex: NSColor
62 let number: NSColor
63 let option: NSColor
64 let symbol: NSColor
65 }