Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tanishqmanuja/ionic-color-injector

Inject custom colors as Ionic CSS Variables at runtime.
https://github.com/tanishqmanuja/ionic-color-injector

css ionic

Last synced: 1 day ago
JSON representation

Inject custom colors as Ionic CSS Variables at runtime.

Awesome Lists containing this project

README

        

![Logo](https://raw.github.com/tanishqmanuja/ionic-color-injector/main/assets/banner.png?maxAge=2592000)

# Ionic Color Injector

Ionic Color Injector is a utility that injects ionic colors with generated css variables into the a html element at runtime.

## Installation

- via npm

```bash
npm install @tqman/ionic-color-injector
```

- via pnpm

```bash
pnpm add @tqman/ionic-color-injector
```

- via bun

```bash
bun install @tqman/ionic-color-injector
```

## Usage

```typescript
import { injectIonicColor } from "@tqman/ionic-color-injector";

// this will inject a style element into the document's head
injectIonicColor("primary", "#428cff");

/* Expected Result



:root {
--ion-color-primary: #428cff;
--ion-color-primary-rgb: 66,140,255;
--ion-color-primary-contrast: #000000;
--ion-color-primary-contrast-rgb: 0,0,0;
--ion-color-primary-shade: #3a7be0;
--ion-color-primary-tint: #5598ff;
}


...

*/
```