Ignite: Theme color override does not work
It seems that whatever you choose as a theme, it always takes the default Bootstrap one. Here’s an example on how to reproduce:
-
Create a new site from scratch
ignite new test -
Add a custom
Themewith a customdangercolor for example:
struct MyTheme: Theme {
var name: String = "test"
let danger: Color = .aliceBlue
}
- Add the new theme to the site:
struct ExampleSite: Site {
var name = "Hello World"
var titleSuffix = " – My Awesome Site"
var url = URL(static: "https://www.example.com")
var builtInIconsEnabled = true
var author = "John Appleseed"
var homePage = Home()
var layout = MainLayout()
// Custom theme
let lightTheme = MyTheme()
}
- Update the home page to use the customized
dangercolor:
struct Home: StaticLayout {
var title = "Home"
var body: some HTML {
Text("Hello world!")
.font(.title1)
.foregroundStyle(.danger)
}
}
- Build and preview the site, the title will still be red and not blue 😦
ignite build; ignite run --preview
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (1 by maintainers)
Fantastic!
That’s expected behavior and the correct way to disable a theme.
Bringing this issue to our attention was a tremendous help—thank you!
I’ll take a look ASAP. Thank you for flagging!