Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
•
a477577
1
Parent(s):
5eac338
small design fix
Browse files
src/components/core/timeline/index.tsx
CHANGED
@@ -4,7 +4,7 @@ import { ClapTimeline, useTimeline, SegmentResolver } from "@aitube/timeline"
|
|
4 |
import { cn } from "@/lib/utils"
|
5 |
import { useMonitor } from "@/controllers/monitor/useMonitor"
|
6 |
import { useResolver } from "@/controllers/resolver/useResolver"
|
7 |
-
|
8 |
|
9 |
export function Timeline() {
|
10 |
const isReady = useTimeline(s => s.isReady)
|
@@ -29,6 +29,10 @@ export function Timeline() {
|
|
29 |
setJumpAt(jumpAt)
|
30 |
setIsPlaying(checkIfPlaying)
|
31 |
setTogglePlayback(togglePlayback)
|
|
|
|
|
|
|
|
|
32 |
startLoop()
|
33 |
}, [isReady])
|
34 |
|
|
|
4 |
import { cn } from "@/lib/utils"
|
5 |
import { useMonitor } from "@/controllers/monitor/useMonitor"
|
6 |
import { useResolver } from "@/controllers/resolver/useResolver"
|
7 |
+
import { useUI } from "@/controllers/ui"
|
8 |
|
9 |
export function Timeline() {
|
10 |
const isReady = useTimeline(s => s.isReady)
|
|
|
29 |
setJumpAt(jumpAt)
|
30 |
setIsPlaying(checkIfPlaying)
|
31 |
setTogglePlayback(togglePlayback)
|
32 |
+
|
33 |
+
// not sure if that's the best place, but once the timeline is loaded
|
34 |
+
// we need to apply theme to it
|
35 |
+
useUI.getState().applyThemeToComponents()
|
36 |
startLoop()
|
37 |
}, [isReady])
|
38 |
|
src/components/editor/ScriptEditor/index.tsx
CHANGED
@@ -114,11 +114,11 @@ export function ScriptEditor() {
|
|
114 |
],
|
115 |
colors: {
|
116 |
'editor.background': theme.editorBgColor || theme.defaultBgColor || '#000000', // Editor background color (given)
|
117 |
-
'editorCursor.foreground':
|
118 |
'editor.lineHighlightBackground': '#44403c', // Highlighted line color
|
119 |
'editorLineNumber.foreground': '#78716c', // Line Numbers color
|
120 |
'editor.selectionBackground': '#44403c', // Selection color
|
121 |
-
'editor.foreground':
|
122 |
'editorIndentGuide.background': '#78716c', // Indent guides color
|
123 |
'editorIndentGuide.activeBackground': '#a8a29e', // Active indent guides color
|
124 |
'editorWhitespace.foreground': '#a8a29e', // Whitespace symbols color
|
|
|
114 |
],
|
115 |
colors: {
|
116 |
'editor.background': theme.editorBgColor || theme.defaultBgColor || '#000000', // Editor background color (given)
|
117 |
+
'editorCursor.foreground': theme.editorCursorColor || theme.defaultPrimaryColor || "", // Cursor color
|
118 |
'editor.lineHighlightBackground': '#44403c', // Highlighted line color
|
119 |
'editorLineNumber.foreground': '#78716c', // Line Numbers color
|
120 |
'editor.selectionBackground': '#44403c', // Selection color
|
121 |
+
'editor.foreground': theme.editorTextColor || theme.defaultTextColor || "", // Main text color
|
122 |
'editorIndentGuide.background': '#78716c', // Indent guides color
|
123 |
'editorIndentGuide.activeBackground': '#a8a29e', // Active indent guides color
|
124 |
'editorWhitespace.foreground': '#a8a29e', // Whitespace symbols color
|
src/controllers/ui/theme.ts
CHANGED
@@ -1,5 +1,17 @@
|
|
1 |
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
export type UITheme = {
|
4 |
id: string
|
5 |
label: string
|
@@ -10,7 +22,8 @@ export type UITheme = {
|
|
10 |
defaultPrimaryColor?: string
|
11 |
logoColor?: string
|
12 |
editorBgColor?: string
|
13 |
-
|
|
|
14 |
|
15 |
// background color of the video preview monitor
|
16 |
monitorBgColor?: string
|
@@ -18,6 +31,8 @@ export type UITheme = {
|
|
18 |
// text of the elapsed/total duration counter in the video preview monitor
|
19 |
monitorSecondaryTextColor?: string
|
20 |
monitorPrimaryTextColor?: string
|
|
|
|
|
21 |
}
|
22 |
|
23 |
// a grey and yellow theme, inspired by the entertainment world
|
@@ -31,26 +46,48 @@ export const backstage: UITheme = {
|
|
31 |
defaultPrimaryColor: "#FACC15",
|
32 |
logoColor: "#FACC15",
|
33 |
editorBgColor: "#292524", // bg-stone-900
|
34 |
-
|
|
|
35 |
monitorBgColor: "#1c1917", // bg-stone-900
|
36 |
monitorSecondaryTextColor: "#D6D3D1",
|
37 |
monitorPrimaryTextColor: "#FACC15",
|
|
|
38 |
}
|
39 |
|
40 |
export const mythril: UITheme = {
|
41 |
id: "mythril",
|
42 |
label: "Mythril",
|
43 |
author: "Clapper",
|
44 |
-
description: "
|
45 |
defaultBgColor: "#092a26",
|
46 |
defaultTextColor: "#b3c0c0",
|
47 |
defaultPrimaryColor: "#2DD4BF",
|
48 |
logoColor: "#2DD4BF",
|
49 |
editorBgColor: "#092a26",
|
50 |
-
|
|
|
51 |
monitorBgColor: "#0d3f39",
|
52 |
monitorSecondaryTextColor: "#D6D3D1",
|
53 |
monitorPrimaryTextColor: "#2DD4BF",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
export const lavender: UITheme = {
|
@@ -63,15 +100,17 @@ export const lavender: UITheme = {
|
|
63 |
defaultPrimaryColor: "#A78BFA",
|
64 |
logoColor: "#A78BFA",
|
65 |
editorBgColor: "#211b32",
|
66 |
-
|
|
|
67 |
monitorBgColor: "#32294b",
|
68 |
monitorSecondaryTextColor: "#D6D3D1",
|
69 |
monitorPrimaryTextColor: "#A78BFA",
|
|
|
70 |
}
|
71 |
-
|
72 |
-
export const
|
73 |
-
id: "
|
74 |
-
label: "
|
75 |
author: "Clapper",
|
76 |
description: "A new DVD rent-by-mail business",
|
77 |
defaultBgColor: "#000000",
|
@@ -79,10 +118,12 @@ export const kibble: UITheme = {
|
|
79 |
defaultPrimaryColor: "#D22F27",
|
80 |
logoColor: "#D22F27",
|
81 |
editorBgColor: "#000000",
|
82 |
-
|
|
|
83 |
monitorBgColor: "#000000",
|
84 |
monitorSecondaryTextColor: "#D6D3D1",
|
85 |
monitorPrimaryTextColor: "#D22F27",
|
|
|
86 |
}
|
87 |
|
88 |
export const sendhugs: UITheme = {
|
@@ -95,15 +136,17 @@ export const sendhugs: UITheme = {
|
|
95 |
defaultPrimaryColor: "#312702",
|
96 |
logoColor: "#312702",
|
97 |
editorBgColor: "#181301",
|
98 |
-
|
|
|
99 |
monitorBgColor: "#312702",
|
100 |
monitorSecondaryTextColor: "#D6D3D1",
|
101 |
monitorPrimaryTextColor: "#312702",
|
|
|
102 |
}
|
103 |
|
104 |
-
export const
|
105 |
-
id: "
|
106 |
-
label: "
|
107 |
author: "Clapper",
|
108 |
description: "",
|
109 |
defaultBgColor: "#151520",
|
@@ -111,15 +154,17 @@ export const circus: UITheme = {
|
|
111 |
defaultPrimaryColor: "#DE4A80",
|
112 |
logoColor: "#DE4A80",
|
113 |
editorBgColor: "#151520",
|
114 |
-
|
|
|
115 |
monitorBgColor: "#151520",
|
116 |
monitorSecondaryTextColor: "#D6D3D1",
|
117 |
monitorPrimaryTextColor: "#DE4A80",
|
|
|
118 |
}
|
119 |
|
120 |
-
export const
|
121 |
-
id: "
|
122 |
-
label: "
|
123 |
author: "Clapper",
|
124 |
description: "",
|
125 |
defaultBgColor: "#412f1f",
|
@@ -127,20 +172,22 @@ export const cappuccino: UITheme = {
|
|
127 |
defaultPrimaryColor: "#D4AA6E",
|
128 |
logoColor: "#D4AA6E",
|
129 |
editorBgColor: "#271c12",
|
130 |
-
|
|
|
131 |
monitorBgColor: "#342619",
|
132 |
monitorSecondaryTextColor: "#c1af9e",
|
133 |
monitorPrimaryTextColor: "#D4AA6E",
|
|
|
134 |
}
|
135 |
export const themes = {
|
136 |
backstage,
|
|
|
137 |
lavender,
|
138 |
-
|
139 |
-
|
140 |
-
kibble,
|
141 |
// sendhugs,
|
142 |
-
|
143 |
-
|
144 |
}
|
145 |
|
146 |
export type UIThemeName = keyof typeof themes
|
|
|
1 |
|
2 |
+
/**
|
3 |
+
* TODO:
|
4 |
+
*
|
5 |
+
* - more colors for Monaco editor
|
6 |
+
*
|
7 |
+
* - change shadcn/ui colors
|
8 |
+
*
|
9 |
+
* - timeline CSS filter is a quick hack to get a hue,
|
10 |
+
* instead (or in addition to it) we could pass color parameters
|
11 |
+
*
|
12 |
+
* - handle light and dark themes
|
13 |
+
*
|
14 |
+
*/
|
15 |
export type UITheme = {
|
16 |
id: string
|
17 |
label: string
|
|
|
22 |
defaultPrimaryColor?: string
|
23 |
logoColor?: string
|
24 |
editorBgColor?: string
|
25 |
+
editorCursorColor?: string
|
26 |
+
editorTextColor?: string
|
27 |
|
28 |
// background color of the video preview monitor
|
29 |
monitorBgColor?: string
|
|
|
31 |
// text of the elapsed/total duration counter in the video preview monitor
|
32 |
monitorSecondaryTextColor?: string
|
33 |
monitorPrimaryTextColor?: string
|
34 |
+
|
35 |
+
timelineFilter: string
|
36 |
}
|
37 |
|
38 |
// a grey and yellow theme, inspired by the entertainment world
|
|
|
46 |
defaultPrimaryColor: "#FACC15",
|
47 |
logoColor: "#FACC15",
|
48 |
editorBgColor: "#292524", // bg-stone-900
|
49 |
+
editorCursorColor: '#f5f5f4',
|
50 |
+
editorTextColor: "#d6d3d1",
|
51 |
monitorBgColor: "#1c1917", // bg-stone-900
|
52 |
monitorSecondaryTextColor: "#D6D3D1",
|
53 |
monitorPrimaryTextColor: "#FACC15",
|
54 |
+
timelineFilter: "",
|
55 |
}
|
56 |
|
57 |
export const mythril: UITheme = {
|
58 |
id: "mythril",
|
59 |
label: "Mythril",
|
60 |
author: "Clapper",
|
61 |
+
description: "You shall not pass",
|
62 |
defaultBgColor: "#092a26",
|
63 |
defaultTextColor: "#b3c0c0",
|
64 |
defaultPrimaryColor: "#2DD4BF",
|
65 |
logoColor: "#2DD4BF",
|
66 |
editorBgColor: "#092a26",
|
67 |
+
editorCursorColor: '#2DD4BF',
|
68 |
+
editorTextColor: "#b3c0c0",
|
69 |
monitorBgColor: "#0d3f39",
|
70 |
monitorSecondaryTextColor: "#D6D3D1",
|
71 |
monitorPrimaryTextColor: "#2DD4BF",
|
72 |
+
timelineFilter: "hue-rotate(93deg) saturate(0.2)",
|
73 |
+
}
|
74 |
+
|
75 |
+
export const midnight: UITheme = {
|
76 |
+
id: "midnight",
|
77 |
+
label: "Midnight",
|
78 |
+
author: "Clapper",
|
79 |
+
description: "",
|
80 |
+
defaultBgColor: "#101e2d",
|
81 |
+
defaultTextColor: "#b8bdc3",
|
82 |
+
defaultPrimaryColor: "#5B9DF1",
|
83 |
+
logoColor: "#5B9DF1",
|
84 |
+
editorBgColor: "#101e2d",
|
85 |
+
editorCursorColor: '#5B9DF1',
|
86 |
+
editorTextColor: "#b8bdc3",
|
87 |
+
monitorBgColor: "#152639",
|
88 |
+
monitorSecondaryTextColor: "#b8bdc3",
|
89 |
+
monitorPrimaryTextColor: "#5B9DF1",
|
90 |
+
timelineFilter: "hue-rotate(147deg) saturate(0.3) brightness(0.95) contrast(1.05)"
|
91 |
}
|
92 |
|
93 |
export const lavender: UITheme = {
|
|
|
100 |
defaultPrimaryColor: "#A78BFA",
|
101 |
logoColor: "#A78BFA",
|
102 |
editorBgColor: "#211b32",
|
103 |
+
editorCursorColor: '#A78BFA',
|
104 |
+
editorTextColor: "#dbd0fd",
|
105 |
monitorBgColor: "#32294b",
|
106 |
monitorSecondaryTextColor: "#D6D3D1",
|
107 |
monitorPrimaryTextColor: "#A78BFA",
|
108 |
+
timelineFilter: "hue-rotate(221deg) saturate(0.3) brightness(0.9) sepia(0.15) contrast(1)"
|
109 |
}
|
110 |
+
|
111 |
+
export const flix: UITheme = {
|
112 |
+
id: "flix",
|
113 |
+
label: "Flix",
|
114 |
author: "Clapper",
|
115 |
description: "A new DVD rent-by-mail business",
|
116 |
defaultBgColor: "#000000",
|
|
|
118 |
defaultPrimaryColor: "#D22F27",
|
119 |
logoColor: "#D22F27",
|
120 |
editorBgColor: "#000000",
|
121 |
+
editorCursorColor: '#D22F27',
|
122 |
+
editorTextColor: "#ffeeee",
|
123 |
monitorBgColor: "#000000",
|
124 |
monitorSecondaryTextColor: "#D6D3D1",
|
125 |
monitorPrimaryTextColor: "#D22F27",
|
126 |
+
timelineFilter: "hue-rotate(47deg) saturate(0.2) brightness(0.85) contrast(1.15)"
|
127 |
}
|
128 |
|
129 |
export const sendhugs: UITheme = {
|
|
|
136 |
defaultPrimaryColor: "#312702",
|
137 |
logoColor: "#312702",
|
138 |
editorBgColor: "#181301",
|
139 |
+
editorCursorColor: '#F8D44E',
|
140 |
+
editorTextColor: "#F8D44E",
|
141 |
monitorBgColor: "#312702",
|
142 |
monitorSecondaryTextColor: "#D6D3D1",
|
143 |
monitorPrimaryTextColor: "#312702",
|
144 |
+
timelineFilter: ""
|
145 |
}
|
146 |
|
147 |
+
export const lore: UITheme = {
|
148 |
+
id: "lore",
|
149 |
+
label: "Lore",
|
150 |
author: "Clapper",
|
151 |
description: "",
|
152 |
defaultBgColor: "#151520",
|
|
|
154 |
defaultPrimaryColor: "#DE4A80",
|
155 |
logoColor: "#DE4A80",
|
156 |
editorBgColor: "#151520",
|
157 |
+
editorCursorColor: '#DE4A80',
|
158 |
+
editorTextColor: "#E3747B",
|
159 |
monitorBgColor: "#151520",
|
160 |
monitorSecondaryTextColor: "#D6D3D1",
|
161 |
monitorPrimaryTextColor: "#DE4A80",
|
162 |
+
timelineFilter: "hue-rotate(303deg) saturate(0.3) brightness(0.9) contrast(1.1)"
|
163 |
}
|
164 |
|
165 |
+
export const mocha: UITheme = {
|
166 |
+
id: "mocha",
|
167 |
+
label: "Mocha",
|
168 |
author: "Clapper",
|
169 |
description: "",
|
170 |
defaultBgColor: "#412f1f",
|
|
|
172 |
defaultPrimaryColor: "#D4AA6E",
|
173 |
logoColor: "#D4AA6E",
|
174 |
editorBgColor: "#271c12",
|
175 |
+
editorCursorColor: '#D4AA6E',
|
176 |
+
editorTextColor: "#CDA983",
|
177 |
monitorBgColor: "#342619",
|
178 |
monitorSecondaryTextColor: "#c1af9e",
|
179 |
monitorPrimaryTextColor: "#D4AA6E",
|
180 |
+
timelineFilter: "hue-rotate(353deg) saturate(1.2) brightness(0.85) contrast(1.09) sepia(0.5)"
|
181 |
}
|
182 |
export const themes = {
|
183 |
backstage,
|
184 |
+
midnight,
|
185 |
lavender,
|
186 |
+
mythril,
|
187 |
+
flix,
|
|
|
188 |
// sendhugs,
|
189 |
+
lore,
|
190 |
+
mocha
|
191 |
}
|
192 |
|
193 |
export type UIThemeName = keyof typeof themes
|
src/controllers/ui/types.ts
CHANGED
@@ -19,6 +19,7 @@ export type UIState = {
|
|
19 |
export type UIControls = {
|
20 |
setHasBetaAccess: (hasBetaAccess: boolean) => void
|
21 |
setThemeName: (themeName: UIThemeName) => void
|
|
|
22 |
getTheme: () => UITheme
|
23 |
setShowApiKeys: (showApiKeys: boolean) => void
|
24 |
setShowSettings: (showSettings: SettingsCategory) => void
|
|
|
19 |
export type UIControls = {
|
20 |
setHasBetaAccess: (hasBetaAccess: boolean) => void
|
21 |
setThemeName: (themeName: UIThemeName) => void
|
22 |
+
applyThemeToComponents: () => void
|
23 |
getTheme: () => UITheme
|
24 |
setShowApiKeys: (showApiKeys: boolean) => void
|
25 |
setShowSettings: (showSettings: SettingsCategory) => void
|
src/controllers/ui/useUI.ts
CHANGED
@@ -18,7 +18,17 @@ export const useUI = create<UIStore>()(
|
|
18 |
},
|
19 |
setThemeName: (themeName: UIThemeName) => {
|
20 |
set({ themeName })
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
},
|
23 |
getTheme: () => {
|
24 |
return themes[get().themeName] || themes.backstage
|
|
|
18 |
},
|
19 |
setThemeName: (themeName: UIThemeName) => {
|
20 |
set({ themeName })
|
21 |
+
get().applyThemeToComponents()
|
22 |
+
},
|
23 |
+
applyThemeToComponents: () => {
|
24 |
+
const theme = get().getTheme()
|
25 |
+
|
26 |
+
// update the editor's theme
|
27 |
+
useEditor.getState().monaco?.editor?.setTheme?.(theme.id)
|
28 |
+
|
29 |
+
// update the timeline's theme
|
30 |
+
const style = document.getElementById("clap-timeline")?.style
|
31 |
+
if (style) { style.filter = theme.timelineFilter }
|
32 |
},
|
33 |
getTheme: () => {
|
34 |
return themes[get().themeName] || themes.backstage
|
src/lib/core/constants.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
export const HARD_LIMIT_NB_MAX_ASSETS_TO_GENERATE_IN_PARALLEL = 32
|
5 |
|
6 |
export const APP_NAME = "Clapper.app"
|
7 |
-
export const APP_REVISION = "r20240624-
|
8 |
|
9 |
export const APP_DOMAIN = "Clapper.app"
|
10 |
export const APP_LINK = "https://clapper.app"
|
|
|
4 |
export const HARD_LIMIT_NB_MAX_ASSETS_TO_GENERATE_IN_PARALLEL = 32
|
5 |
|
6 |
export const APP_NAME = "Clapper.app"
|
7 |
+
export const APP_REVISION = "r20240624-1059"
|
8 |
|
9 |
export const APP_DOMAIN = "Clapper.app"
|
10 |
export const APP_LINK = "https://clapper.app"
|