Skip to content
/ Garnish Public

Garnish helps you pick the ideal colors for text and UI elements in light and dark themes, ensuring ideal contrast and visual harmony based on luminance and brightness

License

Notifications You must be signed in to change notification settings

Aeastr/Garnish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Garnish

Garnish helps you calculate some ideal colors for text and UI elements in light and dark themes, ensuring contrast and visual harmony based on luminance.

This image contains 15 rounded rectangles arranged in a 3x5 grid, each showcasing a unique background color with centered text that reads “Foreground Color.” The rectangles display a variety of colors. The text “Foreground Color” adjusts in contrast against each background to maintain visibility

Features

  • Dynamic Background Colors: Automatically adjust colors for light or dark themes with customizable blending.
  • Contrast-Optimized Foreground Colors: Ensure text is readable against any background.
  • Color Utilities: Access brightness, luminance, and contrast ratio calculations.
  • Blending & Manipulation: Blend colors dynamically and adjust brightness for visual balance.

Join the Kyo Discord

Join the Kyo Discord to discuss features, share feedback, or connect with other users. It's a great place to collaborate and engage with the community.


Getting Started

Installation

Garnish is available as a Swift Package. Add it to your project using the following steps:

  1. In Xcode, go to File > Add Packages...
  2. Enter the repository URL: [https://github.com/Aeastr/Garnish.git]
  3. Add the package to your desired targets.

Examples

Generate a Color for typical backgrounds

Adjust a color to create a background that adapts to the current color scheme.

let backgroundColor = Garnish.bgBase(for: .blue, in: .light)

Generate a Foreground Color

Ensure text or elements are readable against a given background using contrastingForeground.

let foregroundColor = Garnish.contrastingForeground(for: .blue)

More Examples in Docs and Demo in Sources/Garnish/Demo.swift


Documentation Index

Explore detailed documentation for each function and extension under the docs/ directory:


Contribution

We welcome contributions to enhance Garnish! Feel free to open issues or submit pull requests.


License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Garnish helps you pick the ideal colors for text and UI elements in light and dark themes, ensuring ideal contrast and visual harmony based on luminance and brightness

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages