Skip to content

Commit

Permalink
Add color themeable
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbaluk committed Sep 12, 2023
1 parent b608a50 commit 23a1681
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exporter.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "iOS SwiftUI",
"description": "iOS SwiftUI token and style exporter",
"source_dir": "src",
"version": "2.0.0",
"version": "2.1.0",
"usesBrands": true,
"tags": [
"iOS",
Expand Down
4 changes: 4 additions & 0 deletions output.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"invoke": "colors.pr",
"write_to": "Styles/Colors.swift"
},
{
"invoke": "colorsThemeable.pr",
"write_to": "Styles/ColorsThemeable.swift"
},
{
"invoke": "gradients.pr",
"write_to": "Styles/Gradients.swift"
Expand Down
28 changes: 28 additions & 0 deletions src/exported_files/colorsThemeable.pr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import SwiftUI

// Generated by Supernova - do not modify manually

public protocol ColorTokenThemeable {
{[ let brand = ds.currentBrand() /]}
{[ for group in ds.tokenGroupsOfType("Color", brand.id) ]}
{[ if !(group.tokenIds.count() === 0 && group.subgroups.count() === 0) ]}
{[ if !group.isRoot ]}

// {{ group.name }}

{[/]}
{[ const tokens = ds.tokensByGroupId(group.id) /]}
{[ if (group.tokenIds.count() !== 0 && (tokens.first() && tokens.first().description === 0)) ]}

{[/]}
{[ for token in tokens ]}
{[ if (token.description && token.description.count() !== 0) ]}

{{ createDocumentationComment(token.description, " ") }}

{[/]}
static var {[ inject "token_name" context this /]}: Color { get }
{[/]}
{[/]}
{[/]}
}

0 comments on commit 23a1681

Please sign in to comment.