{"id":21976851,"url":"https://github.com/stuartapp/figmagen","last_synced_at":"2025-08-11T19:24:19.761Z","repository":{"id":43691430,"uuid":"456487976","full_name":"StuartApp/figmagen","owner":"StuartApp","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-19T11:48:05.000Z","size":4158,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-30T08:47:42.361Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://stuartapp.github.io/figmagen/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StuartApp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-07T12:02:49.000Z","updated_at":"2024-05-17T07:18:47.000Z","dependencies_parsed_at":"2023-02-10T23:30:33.772Z","dependency_job_id":null,"html_url":"https://github.com/StuartApp/figmagen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/StuartApp/figmagen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StuartApp%2Ffigmagen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StuartApp%2Ffigmagen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StuartApp%2Ffigmagen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StuartApp%2Ffigmagen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StuartApp","download_url":"https://codeload.github.com/StuartApp/figmagen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StuartApp%2Ffigmagen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269941659,"owners_count":24500745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T16:12:28.010Z","updated_at":"2025-08-11T19:24:19.720Z","avatar_url":"https://github.com/StuartApp.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![MavenCentral](https://img.shields.io/maven-central/v/com.stuart.figmagen/figmagen-core?label=MavenCentral)](https://repo1.maven.org/maven2/com/stuart/figmagen/figmagen-core/)\n[![Snapshot](https://img.shields.io/nexus/s/com.stuart.figmagen/figmagen-core?server=https%3A%2F%2Fs01.oss.sonatype.org%2F\u0026label=Snapshot)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/stuart/figmagen/figmagen-core/)\n[![Build](https://img.shields.io/github/workflow/status/StuartApp/figmagen/build-kotlin?label=Build\u0026logo=GitHub)](https://github.com/StuartApp/figmagen/tree/main)\n\n# Figmagen\n\nGenerate tokens from Figma easily for multiple languages or frameworks\n\n## Download\n\n```kotlin\ndependencies {\n    implementation(\"com.stuart.figmagen:figmagen-core:$version\")\n\n    // Kotlin Compose extensions\n    implementation(\"com.stuart.figmagen:figmagen-kotlin-compose-ext:$version\")\n\n    // Swift SwiftUI extensions\n    implementation(\"com.stuart.figmagen:figmagen-swift-swiftui-ext:$version\")\n}\n```\n\n## Usage\n\n1. Create a new instance\n   of [`Figmagen`](figmagen-core/main/kotlin/com/stuart/figmagen/Figmagen.kt):\n\n    ```kotlin\n    // figmaToken is optional as it can be provided\n    // using `FIGMA_TOKEN` environment variable\n    val figmagen = Figmagen(figmaToken = \"...\")\n    ```\n\n2. Add tasks to `Figmagen`:\n\n    ```kotlin\n    val swiftUiColorsTask: Task =\n        SwiftUiColorsTask(\n            checkColorCorrectness = true,\n            outputPath = \"some/path/to/module/with/Colors.kt\",\n            ThemeFile(\"light\", FileKey(\"auAVu6zRJ39zECKv6hWDmH\")),\n            ThemeFile(\"dark\", FileKey(\"wizOikAT1Wigtx6zHpfC87\")),\n        )\n    \n    figmagen.addTask(kotlinComposeColorsTask)\n    ```\n\n3. Generate all files from all tasks\n\n```kotlin\nfigmagen.generate()\n```\n\n## Basic tasks\n\nThe basic tasks are generic tasks which fetch info from Figma files. They have to be extended to add\nthe functionality of each language or platform, for example `KotlinComposeColorsTask`\nextends `ColorsTask` and it has default bindings to generate Kotlin classes, properties and so on.\n\nThere are default implementations for all tasks, but if one is missing, they can be extended easily\nto adapt your needs. Feels free to ask for more tasks or contribute them :)\n\n### [ColorsTask](figmagen-core/main/kotlin/com/stuart/figmagen/tasks/ColorsTask.kt)\n\nAfter providing a list of theme files, it has a `getColors` function with return a list of all\ncolors of all themes provided.\n\n#### Extending ColorsTask\n\n- `themeFiles` has to be overridden providing them.\n- `run` function has to be overridden and should return the list of `TaskFile` that will be\n  generated.\n- Use `getColors` function to easily provides a list of `TaskFile` to the `run` function.\n\n## Implementation for basic tasks\n\n### ColorTasks\n\n- [Kotlin Compose Colors task](exts/figmagen-kotlin-compose-ext/main/kotlin/com/stuart/figmagen/kotlin/compose/extensions/KotlinComposeColorsTask.kt)\n- [SwiftUiColorsTask](exts/figmagen-swift-swiftui-ext/main/kotlin/com/stuart/figmagen/swift/swift/ui/extensions/SwiftUiColorsTask.kt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuartapp%2Ffigmagen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstuartapp%2Ffigmagen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuartapp%2Ffigmagen/lists"}