Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/markdown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions scripts/colorparser/ColorParser.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ val themeWriters = listOf(
val colorAssignmentPattern = " = Color\\(0x[0-9a-fA-F]{8}\\)".toRegex()

fun FileWriter.appendInterfaceFieldLineIfMatches(inputLine: String, inputColorNameSuffix: String) {
if (inputLine.trim().endsWith(inputColorNameSuffix)) {
if (inputLine.contains(inputColorNameSuffix)) {
appendLine(
" " + inputLine.replace(inputColorNameSuffix, "")
.replace(colorAssignmentPattern, ": Color")
Expand All @@ -45,7 +45,7 @@ fun FileWriter.appendInterfaceFieldLineIfMatches(inputLine: String, inputColorNa
}

fun ThemeWriter.appendLineIfMatches(line: String) {
if (line.trim().endsWith(inputColorNameSuffix)) {
if (line.contains(inputColorNameSuffix)) {
writer.append(" override ") // Indentation + override keyword
writer.appendLine(line.replace(inputColorNameSuffix, ""))
}
Expand Down Expand Up @@ -115,4 +115,4 @@ themeWriters.forEach { themeWriter ->
writeAppColorsFooter()
writer.close()
}
}
}
20 changes: 9 additions & 11 deletions scripts/colorparser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@ figma 'Color2Code' plugin, which exports the Color Tokens.

## Usage

1. Open
the [Color Tokens page](https://www.figma.com/file/jTFWg6tZjCWwcxqwkKmykZ/app-foundation?type=design&node-id=1259-12&mode=design&t=BcdgPKHmtGLKMZL8-11)
in Figma.
1. Run the [Color2Code](https://www.figma.com/community/plugin/1262830857362718014) plugin in Figma.
Note: you need edit rights for this, perhaps you need to do
1. Open the Color Tokens page in Figma.
2. Run the [Color2Code](https://www.figma.com/community/plugin/1262830857362718014) plugin in Figma.
Note: you need Design or Dewv Mode for this, perhaps you need to do
this in collaboration with a designer.
2. Export the Color Tokens using the plugin. Disable `Remove group names`; enable
`Camel case naming` select `Android` and `Semantics`.
3. Export the Color Tokens using the plugin. Select `Android` and format `Compose`. Disable `Remove group names`; enable
`Camel case naming`.
![Color 2 Code settings](color_parser_color_2_code.png)
3. Copy the output of the plugin and paste it into the `color_parser_input.txt` file.
4. Run the `ColorParser.kts` script by clicking the play button in the file or running
4. Copy the output of the plugin and paste it into the `color_parser_input.txt` file.
5. Run the `ColorParser.kts` script by clicking the play button in the file or running

`./scripts/colorparser/ColorParser.kts`
`(cd ./scripts/colorparser && ./ColorParser.kts)`

5. The script will update the `AppColorScheme.kt` file and the corresponding files for both the
6. The script will update the `AppColorScheme.kt` file and the corresponding files for both the
light and dark themes.

## File Structure
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading