{"id":14960608,"url":"https://github.com/ivanmurzak/unity-theme","last_synced_at":"2025-04-06T07:09:51.060Z","repository":{"id":39700839,"uuid":"462434436","full_name":"IvanMurzak/Unity-Theme","owner":"IvanMurzak","description":"Create palettes of colors and components for change specific color on a specific visual element. Very useful to UI.","archived":false,"fork":false,"pushed_at":"2025-03-31T12:04:45.000Z","size":2642,"stargazers_count":135,"open_issues_count":3,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T07:07:51.435Z","etag":null,"topics":["ugui","ui","unity","unity-plugin"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IvanMurzak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-22T18:57:04.000Z","updated_at":"2025-04-04T15:17:15.000Z","dependencies_parsed_at":"2025-02-09T09:30:41.491Z","dependency_job_id":null,"html_url":"https://github.com/IvanMurzak/Unity-Theme","commit_stats":{"total_commits":122,"total_committers":1,"mean_commits":122.0,"dds":0.0,"last_synced_commit":"fde447dba6d3323e8ac1051f7303a4b4736bb46c"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IvanMurzak%2FUnity-Theme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IvanMurzak%2FUnity-Theme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IvanMurzak%2FUnity-Theme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IvanMurzak%2FUnity-Theme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IvanMurzak","download_url":"https://codeload.github.com/IvanMurzak/Unity-Theme/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445668,"owners_count":20939958,"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":["ugui","ui","unity","unity-plugin"],"created_at":"2024-09-24T13:22:36.201Z","updated_at":"2025-04-06T07:09:51.032Z","avatar_url":"https://github.com/IvanMurzak.png","language":"C#","readme":"# Unity-Theme\n\n![npm](https://img.shields.io/npm/v/extensions.unity.theme) [![openupm](https://img.shields.io/npm/v/extensions.unity.theme?label=openupm\u0026registry_uri=https://package.openupm.com)](https://openupm.com/packages/extensions.unity.theme/) ![License](https://img.shields.io/github/license/IvanMurzak/Unity-Theme) [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)\n\n| Unity Version | Editor test | Player test | Build test |\n|---------------|-------------|-------------|------------|\n| 2022.3.57f1   | ![2022.3.57f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/2022.3.57f1_editor.yml?label=2022.3.57f1-Editor) | ![2022.3.57f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/2022.3.57f1_player.yml?label=2022.3.57f1-Player) | ![2022.3.57f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/2022.3.57f1_build.yml?label=2022.3.57f1-Build) |\n| 2023.1.20f1   | ![2023.1.20f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/2023.1.20f1_editor.yml?label=2023.1.20f1-Editor) | ![2023.1.20f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/2023.1.20f1_player.yml?label=2023.1.20f1-Player) | ![2023.1.20f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/2023.1.20f1_build.yml?label=2023.1.20f1-Build) |\n| 2023.2.20f1   | ![2023.2.20f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/2023.2.20f1_editor.yml?label=2023.2.20f1-Editor) | ![2023.2.20f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/2023.2.20f1_player.yml?label=2023.2.20f1-Player) | ![2023.2.20f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/2023.2.20f1_build.yml?label=2023.2.20f1-Build) |\n| 6000.0.37f1   | ![6000.0.37f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/6000.0.37f1_editor.yml?label=6000.0.37f1-Editor) | ![6000.0.37f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/6000.0.37f1_player.yml?label=6000.0.37f1-Player) | ![6000.0.37f1](https://img.shields.io/github/actions/workflow/status/IvanMurzak/Unity-Theme/6000.0.37f1_build.yml?label=6000.0.37f1-Build) |\n\nCreate palettes of colors and components to change specific colors on a specific visual element. Very useful for UI.\n\n![Unity-Theme-1](https://github.com/IvanMurzak/Unity-Theme/assets/9135028/1c545d11-aea4-4cd2-8aaa-75539bbb6699)\n\n## Features\n\n- ✔️ Name colors\n- ✔️ Create custom themes with names\n- ✔️ Add as many colors as you need\n- ✔️ Name a theme as you want\n- ✔️ Change theme any moment by name\n- ✔️ Bind color to: `Image`, `SpriteRenderer`, `TextMeshPro`, etc\n- ✔️ Easy way to add custom color binder by new C# class with just a few lines of code\n- ✔️ Rename color even after binding to a component, with no broken links\n\n## Installation\n\n- [Install OpenUPM-CLI](https://github.com/openupm/openupm-cli#installation)\n- Open command line in Unity project folder\n\n```bash\nopenupm add extensions.unity.theme\n```\n\n## Usage\n\n- Go to `Window/Unity-Theme`\n- Customize color palettes as you want\n- Add `ColorBinder` components to a target GameObject\n\n### Color Binder\n\nA component that binds a color to a specific target, such as `Image`, `SpriteRenderer`, `TextMeshPro`, or anything else.\n\nThere is a list of built-in color binders:\n\n- `ImageColorBinder`\n- `SpriteRendererColorBinder`\n- `TextMeshProColorBinder`\n\n![Unity-Theme-Binder](https://github.com/IvanMurzak/Unity-Theme/assets/9135028/6198af48-9f0e-4cda-b5e9-40508bbd5c45)\n\n### Color palettes\n\nModify palettes, instant response with all connected GameObjects.\n\n![Unity-Theme-Palettes](https://github.com/IvanMurzak/Unity-Theme/assets/9135028/179215af-23f1-4a8e-bb29-a7169f3433a5)\n\n## C# Api\n\n### Colors\n\n```csharp\nusing Unity.Theme;\n\nTheme.Instance.AddColor(\"Primary\", \"#6750A4\");\nTheme.Instance.AddColor(\"Primary\", Color.white);\n\nTheme.Instance.SetColor(\"Primary\", \"#6750A4\");\nTheme.Instance.SetColor(\"Primary\", Color.white);\n\nTheme.Instance.SetOrAddColor(\"Primary\", \"#6750A4\");\nTheme.Instance.SetOrAddColor(\"Primary\", Color.white);\n\nTheme.Instance.RemoveColorByName(\"Primary\");\nTheme.Instance.RemoveColor(colorData);\nTheme.Instance.RemoveAllColors();\n```\n\n### Themes\n\n```csharp\nusing Unity.Theme;\n\nTheme.Instance.AddTheme(\"Light\");\nTheme.Instance.SetOrAddTheme(\"Light\");\n\nTheme.Instance.CurrentThemeName = \"Light\";\nTheme.Instance.CurrentThemeIndex = 0;\n\nTheme.Instance.RemoveTheme(\"Light\");\nTheme.Instance.RemoveAllThemes();\n```\n\n### Create a custom `ColorBinder`\n\nIf you need to bind color to something else, you may extend from `BaseColorBinder` as listed below.\n\n```C#\nusing UnityEngine;\nusing TMPro;\n\nnamespace Unity.Theme.Binders\n{\n    [AddComponentMenu(\"Theme/TextMeshPro Color Binder\")]\n    public class TextMeshProColorBinder : GenericColorBinder\u003cTextMeshProUGUI\u003e\n    {\n        protected override void SetColor(TextMeshProUGUI target, Color color)\n            =\u003e target.color = color;\n\n        protected override Color? GetColor(TextMeshProUGUI target)\n            =\u003e target.color;\n    }\n}\n```\n\n## Other\n\n- **[Color palette builder](https://m3.material.io/theme-builder#/custom)** by Google's Material Design V3\n\n---\n\n## Migration from `2.x.x` version\n\nThe version `3.x.x` or newer has a different database structure, so you need to migrate your data manually if you want to keep existed binders to still be connected to a right color. The binders are using GUIDs to connect to colors.\n\n\u003e ❗❗❗**Please follow the exact steps order**\n\n### Step 1\n\nClose Unity project to avoid any data loss.\n\n### Step 2 - backup\n\n- Make a backup copy of `Assets/Resources/Unity-Theme Database.asset`, put it outside of a project.\n- Make a screenshot of colors in each theme to reproduce them later with color picker.\n\n### Step 3 - database template\n\n- Download [Unity-Theme-Database.json](https://raw.githubusercontent.com/IvanMurzak/Unity-Theme/refs/heads/main/Assets/Resources/Unity-Theme-Database.json).\n- Save it at `Assets/Resources/Unity-Theme-Database.json`.\n- Use it as a template. Feel free to delete all existed colors if you want.\n\n### Step 4 - data migration\n\n**You need to copy GUIDs** from `Assets/Resources/Unity-Theme Database.asset`  to `Assets/Resources/Unity-Theme-Database.json`. To do that, please take a look at the samples below. You may see what is data format of old and new databases, and how to copy GUIDs. You may ignore color for now, it is easier to change color values later using color picker tool and the screenshot of old color palette.\n\n#### Sample of `Assets/Resources/Unity-Theme Database.asset` - old file (source)\n\nTake a look at the `guid: 6b934efb-0b9b-42fd-82fd-7a0dbd1de53c`, the file contains it 3 times, depends on your setup. You would need to copy the guid to the `Unity-Theme-Database.json` file.\n\n```yaml\n  colors:\n  - guid: 6b934efb-0b9b-42fd-82fd-7a0dbd1de53c\n    name: Primary\n  - guid: 520b0288-c5e4-4106-95ae-095ad2dcceb8\n    name: Primary Text\n  - guid: 465741bc-25d8-4722-a981-7e4a18074d83\n    name: Primary Container\n  themes:\n  - guid: 6d1fce4e-1938-4d6d-93b0-b4b9f6497293\n    expanded: 1\n    themeName: Light\n    colors:\n    - guid: 6b934efb-0b9b-42fd-82fd-7a0dbd1de53c\n      color: {r: 0.40392157, g: 0.3137255, b: 0.6431373, a: 1}\n    - guid: 520b0288-c5e4-4106-95ae-095ad2dcceb8\n      color: {r: 1, g: 1, b: 1, a: 1}\n    - guid: 465741bc-25d8-4722-a981-7e4a18074d83\n      color: {r: 0.91764706, g: 0.8666667, b: 1, a: 1}\n  - guid: 54c71f36-6023-4d84-bce7-c8192cf7ba40\n    expanded: 1\n    themeName: Dark\n    colors:\n    - guid: 6b934efb-0b9b-42fd-82fd-7a0dbd1de53c\n      color: {r: 0, g: 0.4784314, b: 1, a: 1}\n    - guid: 520b0288-c5e4-4106-95ae-095ad2dcceb8\n      color: {r: 1, g: 1, b: 1, a: 1}\n    - guid: 465741bc-25d8-4722-a981-7e4a18074d83\n      color: {r: 0.15294118, g: 0.15294118, b: 0.15686275, a: 1}\n```\n\n### Sample of `Assets/Resources/Unity-Theme-Database.json` - new file (destination)\n\nThat is the file that you need to make in the end of the migration process.\nWhen you done, you may need to close \u0026 open Unity project to let Unity-Theme to reload the data.\n\n```json\n{\n  \"debugLevel\": 2,\n  \"currentThemeIndex\": 1,\n  \"colors\": [\n    { \"guid\": \"6b934efb-0b9b-42fd-82fd-7a0dbd1de53c\", \"name\": \"Primary\" },\n    { \"guid\": \"520b0288-c5e4-4106-95ae-095ad2dcceb8\", \"name\": \"Primary Text\" },\n    { \"guid\": \"465741bc-25d8-4722-a981-7e4a18074d83\", \"name\": \"Primary Container\" }\n  ],\n  \"themes\": [\n    {\n      \"guid\": \"4cfe4185-bc3e-4247-969f-1da1d3f2bdec\",\n      \"expanded\": true,\n      \"themeName\": \"Light\",\n      \"colors\": [\n        { \"guid\": \"6b934efb-0b9b-42fd-82fd-7a0dbd1de53c\", \"colorHex\": \"#6750A4FF\" },\n        { \"guid\": \"520b0288-c5e4-4106-95ae-095ad2dcceb8\", \"colorHex\": \"#FFFFFFFF\" },\n        { \"guid\": \"465741bc-25d8-4722-a981-7e4a18074d83\", \"colorHex\": \"#EADDFFFF\" }\n      ]\n    },\n    {\n      \"guid\": \"dca52c83-4f79-4fee-854e-0defe9ccbe07\",\n      \"expanded\": true,\n      \"themeName\": \"Dark\",\n      \"colors\": [\n        { \"guid\": \"6b934efb-0b9b-42fd-82fd-7a0dbd1de53c\", \"colorHex\": \"#007AFFFF\" },\n        { \"guid\": \"520b0288-c5e4-4106-95ae-095ad2dcceb8\", \"colorHex\": \"#FFFFFFFF\" },\n        { \"guid\": \"465741bc-25d8-4722-a981-7e4a18074d83\", \"colorHex\": \"#272728FF\" }\n      ]\n    }\n  ]\n}\n```\n\n### Step 5 - package update\n\n- Delete Unity-Theme `2.x.x` from the project while Unity is closed\n\n```bash\nopenupm remove extensions.unity.theme\n```\n\n- Install latest Unity-Theme\n\n```bash\nopenupm add extensions.unity.theme\n```\n\n### Step 6 - cleaning up\n\n- Delete the `Assets/Resources/Unity-Theme Database.asset` file (original and copy).\n- ✅ migration completed, well done!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanmurzak%2Funity-theme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanmurzak%2Funity-theme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanmurzak%2Funity-theme/lists"}