From a9d2fc5adf1bcd9ff8d4eb02e69b24a0ab859f9d Mon Sep 17 00:00:00 2001 From: JingZhang Chen Date: Thu, 29 Feb 2024 17:13:55 +0800 Subject: [PATCH] color schema setting --- build.sbt | 6 +++--- .../sbt/paradox/material/theme/ParadoxMaterialTheme.scala | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 962daa1..3691f98 100644 --- a/build.sbt +++ b/build.sbt @@ -23,7 +23,7 @@ lazy val root = project("paradox-material-theme-parent", file(".")) ), // #color Compile / paradoxMaterialTheme ~= { - _.withColor("teal", "indigo") + _.withColor("default", "teal", "indigo") } // #color , @@ -111,14 +111,14 @@ lazy val optionExamples = Def.settings( // #builder-api Compile / paradoxMaterialTheme := { ParadoxMaterialTheme() - .withColor("red", "orange") + .withColor("default", "red", "orange") .withCopyright("Copyleft © Jonas Fonseca") } // #builder-api , // #builder-api-v2 Compile / paradoxMaterialTheme ~= { - _.withColor("red", "orange") + _.withColor("default", "red", "orange") .withCopyright("Copyleft © Jonas Fonseca") } // #builder-api-v2 diff --git a/plugin/src/main/scala/com/github/sbt/paradox/material/theme/ParadoxMaterialTheme.scala b/plugin/src/main/scala/com/github/sbt/paradox/material/theme/ParadoxMaterialTheme.scala index 76a9e59..94dc522 100644 --- a/plugin/src/main/scala/com/github/sbt/paradox/material/theme/ParadoxMaterialTheme.scala +++ b/plugin/src/main/scala/com/github/sbt/paradox/material/theme/ParadoxMaterialTheme.scala @@ -10,10 +10,12 @@ final case class ParadoxMaterialTheme(properties: Map[String, String]) { def withLanguage(locale: Locale) = withProperties("language" -> locale.getLanguage) - def withColor(primaryColor: String, accentColor: String) = { + def withColor(colorSchema: String, primaryColor: String, accentColor: String) = { + val schema = colorSchema.replace(" ", "-").toLowerCase val primary = primaryColor.replace(" ", "-").toLowerCase val accent = accentColor.replace(" ", "-").toLowerCase val colorProps = withProperties( + "color.schema" -> schema, "color.primary" -> primary, "color.accent" -> accent )