Hi and thanks for a great framework!
I have a specific situation where I’d like to fully customise the colors, no matter the OS or preferred light/dark mode.
I can easily achieve a lot of this by applying:
// In App.tsx
const f7params: Framework7Parameters = {
darkMode: false,
theme: "md"
colors: { primary: "#2c3f5c" }
}
This forces the Material theme and disables dark mode. In addition F7 automatically calculates (as far as I understand) the color palette using my provided primary color #2c3f5c
.
Unfortunately, calculating the palette from #2c3f5c
is not what I need in this case: I want to further modify the theme by providing a custom palette.
I think that changing a couple of the CSS variables would do it. So I tried something like:
/* app.css */
:root {
--f7-ios-primary: #2c3f5c;
--f7-ios-primary-shade: #ababab; /* some really wired color from our palette, unrelated to #2c3f5c */
--f7-ios-primary-tint: #aeaeae; /* more custom colors, impossible to calculate from #2c3f5c */
--f7-ios-primary-rgb: 123, 5, 0; /* and so on.... */
--f7-md-primary-shade: #970100;
--f7-md-primary-tint: #e90100;
--f7-md-primary-rgb: 192, 1, 0;
--f7-md-primary: #c00100;
...
However, it seems as all CSS variables are dynamically overridden when F7 initiates, so the values I set in app.css
have no effect.
Is there any other way I can override the CSS variables and make them prevail even after F7 initialises? Perhaps I somehow must stop F7 from running setColorTheme()
on init?