{"id":28604032,"url":"https://github.com/uber/stylist","last_synced_at":"2025-06-11T17:40:21.202Z","repository":{"id":52180981,"uuid":"144774873","full_name":"uber/stylist","owner":"uber","description":"A stylist creates cool styles. Stylist is a Gradle plugin that codegens a base set of Android XML themes.","archived":false,"fork":false,"pushed_at":"2023-05-01T21:40:40.000Z","size":203,"stargazers_count":355,"open_issues_count":7,"forks_count":10,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-05-09T07:59:03.818Z","etag":null,"topics":["android","codegen","kotlin","styles","themes"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uber.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-14T21:40:56.000Z","updated_at":"2023-10-06T20:45:56.000Z","dependencies_parsed_at":"2022-08-24T01:20:39.246Z","dependency_job_id":null,"html_url":"https://github.com/uber/stylist","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/uber/stylist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fstylist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fstylist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fstylist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fstylist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uber","download_url":"https://codeload.github.com/uber/stylist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fstylist/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259308163,"owners_count":22837974,"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","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":["android","codegen","kotlin","styles","themes"],"created_at":"2025-06-11T17:40:11.943Z","updated_at":"2025-06-11T17:40:21.194Z","avatar_url":"https://github.com/uber.png","language":"Kotlin","readme":"# Stylist [![Build Status](https://travis-ci.org/uber/stylist.svg?branch=master)](https://travis-ci.org/uber/stylist)\n\nAs Android apps grow, providing common styling across app themes becomes challenging. Typically, this results in copy-pasting style items across themes, monolithic themes, or complicated inheritance trees. Stylist is a highly-extensible platform for creating and maintaining an app’s base set of Android XML themes.\n\n## Overview\n\nStylist is a Gradle plugin written in Kotlin that generates a base set of Android XML themes. Stylist-generated themes are created using a stencil and trait system. Each theme is declared with a single stencil, which is comprised of sets of logically-grouped style items. All of this comes together to create an easily maintainable system of stencils and traits.\n\n*ThemeStencils*: A 1:1 ratio of `ThemeStencil`s to corresponding generated themes. Each `ThemeStencil` declares a theme name and parent theme plus any extra `StyleItemGroup`s that should be included in addition to the globally applicable set.\n\n*StyleItemGroups*: Each `StyleItemGroup` can be declared by multiple `ThemeStencil`s and generate otherwise duplicated style items across all themes that include them. Common examples include default app colors, font sizes, and common dimension values. They are a logical groupings of custom theme attributes that get included in each theme that declares the group.\n\n## Usage\n\nA simple `ThemeStencilProvider` that defines text sizes in Dark and Light themes would look like:\n\n```kotlin\n@AutoService(ThemeStencilProvider::class)\nclass SampleThemeStencilProvider : ThemeStencilProvider {\n\n  private val textSizes = StyleItemGroup(\n      StyleItem(\"textSizeSmall\", \"12dp\"),\n      StyleItem(\"textSizeMedium\",\"16dp\"),\n      StyleItem(\"textSizeLarge\", \"20dp\")\n  )\n\n  override fun stencils() = linkedSetOf(\n      ThemeStencil(\"Theme.Sample.Dark\", \"Theme.AppCompat\"),\n      ThemeStencil(\"Theme.Sample.Light\", \"Theme.AppCompat.Light\")\n  )\n\n  override fun globalStyleItemGroups() = linkedSetOf(\n      textSizes\n  )\n}\n```\n\nLeaving you with a generated themes XML resource file like this:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?\u003e\n\u003cresources\u003e\n  \u003cstyle name=\"Theme.Sample.Dark\" parent=\"Theme.AppCompat\"\u003e\n    \u003citem name=\"textSizeSmall\"\u003e12dp\u003c/item\u003e\n    \u003citem name=\"textSizeMedium\"\u003e16dp\u003c/item\u003e\n    \u003citem name=\"textSizeLarge\"\u003e20dp\u003c/item\u003e\n  \u003c/style\u003e\n  \u003cstyle name=\"Theme.Sample.Light\" parent=\"Theme.AppCompat.Light\"\u003e\n    \u003citem name=\"textSizeSmall\"\u003e12dp\u003c/item\u003e\n    \u003citem name=\"textSizeMedium\"\u003e16dp\u003c/item\u003e\n    \u003citem name=\"textSizeLarge\"\u003e20dp\u003c/item\u003e\n  \u003c/style\u003e\n\u003c/resources\u003e\n```\n\nThis may look like a lot of boilerplate for simple style item shared by two themes, but it scales quite well when you want to have many custom color, dimension, and other style items on _numerous_ app themes and custom theme attributes.\n\n## Download\n\nStylist [![Maven Central](https://img.shields.io/maven-central/v/com.uber.stylist/stylist.svg)](https://mvnrepository.com/artifact/com.uber.stylist/stylist)\n```gradle\nclasspath 'com.uber.stylist:stylist:0.0.2'\n```\n\nStylist Core [![Maven Central](https://img.shields.io/maven-central/v/com.uber.stylist/stylist-core.svg)](https://mvnrepository.com/artifact/com.uber.stylist/stylist-core)\n```gradle\nclasspath 'com.uber.stylist:stylist-core:0.0.2'\n```\n\nStylist API [![Maven Central](https://img.shields.io/maven-central/v/com.uber.stylist/stylist-api.svg)](https://mvnrepository.com/artifact/com.uber.stylist/stylist-api)\n```gradle\nclasspath 'com.uber.stylist:stylist-api:0.0.2'\n```\n\n## License\n\n```\nCopyright (C) 2018 Uber Technologies\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Fstylist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuber%2Fstylist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Fstylist/lists"}