Skip to content

Commit

Permalink
color schema setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Roiocam committed Feb 29, 2024
1 parent 48102ff commit a9d2fc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ lazy val root = project("paradox-material-theme-parent", file("."))
),
// #color
Compile / paradoxMaterialTheme ~= {
_.withColor("teal", "indigo")
_.withColor("default", "teal", "indigo")
}
// #color
,
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit a9d2fc5

Please sign in to comment.