@@ -7,6 +7,8 @@ import androidx.compose.runtime.Composable
77import androidx.compose.runtime.CompositionLocalProvider
88import androidx.compose.runtime.compositionLocalOf
99import androidx.compose.ui.graphics.Color
10+ import processing.app.LocalPreferences
11+ import processing.app.PreferencesProvider
1012import java.io.InputStream
1113import java.util.Properties
1214
@@ -28,31 +30,33 @@ fun ProcessingTheme(
2830 darkTheme : Boolean = isSystemInDarkTheme(),
2931 content : @Composable() () -> Unit
3032) {
33+ PreferencesProvider {
34+ val preferences = LocalPreferences .current
35+ val theme = Theme (preferences.getProperty(" theme" ))
36+ val colors = Colors (
37+ primary = theme.getColor(" editor.gradient.top" ),
38+ primaryVariant = theme.getColor(" toolbar.button.pressed.field" ),
39+ secondary = theme.getColor(" editor.gradient.bottom" ),
40+ secondaryVariant = theme.getColor(" editor.scrollbar.thumb.pressed.color" ),
41+ background = theme.getColor(" editor.bgcolor" ),
42+ surface = theme.getColor(" editor.bgcolor" ),
43+ error = theme.getColor(" status.error.bgcolor" ),
44+ onPrimary = theme.getColor(" toolbar.button.enabled.field" ),
45+ onSecondary = theme.getColor(" toolbar.button.enabled.field" ),
46+ onBackground = theme.getColor(" editor.fgcolor" ),
47+ onSurface = theme.getColor(" editor.fgcolor" ),
48+ onError = theme.getColor(" status.error.fgcolor" ),
49+ isLight = theme.getProperty(" laf.mode" ).equals(" light" )
50+ )
3151
32- val theme = Theme ()
33- val colors = Colors (
34- primary = theme.getColor(" editor.gradient.top" ),
35- primaryVariant = theme.getColor(" toolbar.button.pressed.field" ),
36- secondary = theme.getColor(" editor.gradient.bottom" ),
37- secondaryVariant = theme.getColor(" editor.scrollbar.thumb.pressed.color" ),
38- background = theme.getColor(" editor.bgcolor" ),
39- surface = theme.getColor(" editor.bgcolor" ),
40- error = theme.getColor(" status.error.bgcolor" ),
41- onPrimary = theme.getColor(" toolbar.button.pressed.field" ),
42- onSecondary = theme.getColor(" toolbar.button.pressed.field" ),
43- onBackground = theme.getColor(" editor.fgcolor" ),
44- onSurface = theme.getColor(" editor.fgcolor" ),
45- onError = theme.getColor(" status.error.fgcolor" ),
46- isLight = theme.getProperty(" laf.mode" ).equals(" light" )
47- )
48-
49- CompositionLocalProvider (LocalTheme provides theme) {
50- LocaleProvider {
51- MaterialTheme (
52- colors = colors,
53- typography = Typography ,
54- content = content
55- )
52+ CompositionLocalProvider (LocalTheme provides theme) {
53+ LocaleProvider {
54+ MaterialTheme (
55+ colors = colors,
56+ typography = Typography ,
57+ content = content
58+ )
59+ }
5660 }
5761 }
5862}
0 commit comments