Skip to content

Commit 3d2ebe8

Browse files
authored
release: version 2025.5.12 (#25)
1 parent cf70044 commit 3d2ebe8

File tree

314 files changed

+961
-60027
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+961
-60027
lines changed

.gitignore

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
1-
generate/
2-
node_modules/
3-
4-
npm-debug.log
5-
yarn-debug.log*
6-
yarn-error.log*
1+
*
72

3+
node_modules/
84
.idea/
95
.vscode/
106

11-
*.log
12-
*.tmp
13-
*.temp
14-
*.suo
15-
*.ntvs*
16-
*.njsproj
17-
*.sln
18-
*.sw?
19-
*.iml
20-
217
.DS_Store
22-
Thumbs.db
23-
24-
dist/
25-
build/
26-
27-
config.js
28-
secrets.json
29-
30-
*.key
31-
*.pem
328

33-
.coverage
9+
!.editorconfig
10+
!CONTRIBUTING.md
11+
!LICENSE
12+
!main.js
13+
!package.json
14+
!README.md
15+
!yarn.lock
16+
17+
!.github/
18+
!generators/
19+
!generators/**
20+
!utils/
21+
!utils/**

.npmignore

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
!/package.json
2-
!/README.md
3-
!/src/**/*
4-
!/*.css
5-
61
*
2+
3+
!main.js
4+
!package.json
5+
!README.md
6+
!LICENSE
7+
!CONTRIBUTING.md
8+
9+
!generators/
10+
!generators/**
11+
!utils/
12+
!utils/**

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@
66
![npm](https://img.shields.io/npm/dm/style-forge.colors)
77
![build](https://github.com/Style-Forge/colors/actions/workflows/release.yml/badge.svg)
88

9-
`Style-Forge.Colors` package provides a comprehensive and customizable set of color palettes for your web applications. It includes predefined color schemes and the ability to create your own custom palettes, ensuring consistent and visually appealing designs across your projects.
9+
`Style-Forge.Colors` is an atomic CSS palette generator based on the HSL color model. Generate exactly the colors you need — programmatically, interactively, or by name. Perfect for design systems, theming, and scalable UIs.
10+
11+
## 🎯 Modifier Suffixes
12+
13+
Style-Forge Colors provides utility modifiers to fine-tune element behavior:
14+
15+
| Suffix | Meaning | Applies to |
16+
|------------|--------------------------------------|----------|
17+
| `:st` | Static. Ignores theme-based changes. | `bg`, `txt` |
18+
| `:txt` | Text color based on contrast logic. | `txt` |
19+
| `:txt:st` | Static text color. | `txt` |
20+
| `:txt:rv` | Reversed text (for strong contrast). | `txt` |
21+
22+
> Combine them like `.sf-c-180:100:50:txt:st` for consistent control across themes.
1023
1124
## Documentation
1225

@@ -81,7 +94,7 @@ If you feel awesome and want to support us in a small way, please consider starr
8194
<td><a href="https://github.com/Style-Forge/colors" target="_blank">GitHub</a></td>
8295
<td><a href="https://npmjs.com/package/style-forge.colors" target="_blank">NPM</a></td>
8396
<td><img src="https://img.shields.io/npm/v/style-forge.colors" alt="npm"></td>
84-
<td>Color palettes and styles for the project.</td>
97+
<td>Atomic HSL-based color generator and palette engine.</td>
8598
</tr>
8699
</table>
87100

builder.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

colors.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

generators/styleBlocks.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { getLuminance, getContrastRatio } from '../utils/tools.js'
2+
import { HSLToRGB } from '../utils/convert.js'
3+
4+
const blackLum = getLuminance(HSLToRGB([0, 0, 0]))
5+
6+
export function generateSingleColorCSS(H, S, L) {
7+
const baseLum = getLuminance(HSLToRGB([H, S, L]))
8+
const contrast = getContrastRatio(blackLum, baseLum)
9+
const textL = contrast > 7 ? 10 : 90
10+
const textL_REV = contrast < 7 ? 10 : 90
11+
12+
const lines = []
13+
14+
const SELECTOR = `.sf-c-${H}\\:${S}\\:${L}`
15+
const HSL = `hsl(${H}, ${S}%, ${L}%)`
16+
const LUM = `hsl(${H}, ${S}%, ${textL}%)`
17+
18+
const TX_LUM_REV = `hsl(${H}, ${S}%, ${textL_REV}%)`
19+
const BG_LUM_REV = `hsl(${H}, ${S}%, ${100 - L}%)`
20+
21+
// var
22+
lines.push(`${SELECTOR}\\:var { --sf-c-${H}-${S}-${L}: ${H} ${S} ${L} }`)
23+
24+
// light
25+
lines.push(`${SELECTOR}, ${SELECTOR}\\:st { color: ${LUM}; background-color: ${HSL} }`)
26+
27+
// Text
28+
// lines.push(`${SELECTOR}\\:txt { color: hsl(${H}, ${S}%, ${L > 50 ? 10 : L}%) }`)
29+
lines.push(`${SELECTOR}\\:txt, ${SELECTOR}\\:txt\\:st, ${SELECTOR}\\:txt\\:rv { color: ${HSL} }`)
30+
31+
lines.push('')
32+
33+
// dark
34+
lines.push(`html[data-theme='dark'] ${SELECTOR}, html.dark ${SELECTOR} { color: ${TX_LUM_REV}; background-color: ${BG_LUM_REV} }`)
35+
lines.push(`html[data-theme='dark'] ${SELECTOR}\\:st, html.dark ${SELECTOR}\\:st { color: ${LUM}; background-color: ${HSL} }`)
36+
// lines.push(`html[data-theme='dark'] ${SELECTOR}\\:txt, html.dark ${SELECTOR}\\:txt { color: hsl(${H}, ${S}%, ${L < 50 ? 100 - L : L}%) }`)
37+
lines.push(`html[data-theme='dark'] ${SELECTOR}\\:txt, html.dark ${SELECTOR}\\:txt { color: hsl(${H}, ${S}%, ${90}%) }`)
38+
lines.push(`html[data-theme='dark'] ${SELECTOR}\\:txt\\:st, html.dark ${SELECTOR}\\:txt\\:st { color: ${HSL} }`)
39+
lines.push(`html[data-theme='dark'] ${SELECTOR}\\:txt\\:rv, html.dark ${SELECTOR}\\:txt\\:rv { color: hsl(${H}, ${S}%, ${10}%) }`)
40+
41+
lines.push('')
42+
43+
// auto
44+
lines.push(`@media (prefers-color-scheme: dark) {`)
45+
lines.push(` html[data-theme='auto'] ${SELECTOR}, html.auto ${SELECTOR} { color: ${TX_LUM_REV}; background-color: ${BG_LUM_REV} }`)
46+
lines.push(` html[data-theme='auto'] ${SELECTOR}\\:st, html.auto ${SELECTOR}\\:st { color: ${LUM}; background-color: ${HSL} }`)
47+
// lines.push(` html[data-theme='auto'] ${SELECTOR}\\:txt, html.auto ${SELECTOR}\\:txt { color: hsl(${H}, ${S}%, ${L < 50 ? 100 - L : L}%) }`)
48+
lines.push(` html[data-theme='auto'] ${SELECTOR}\\:txt, html.auto ${SELECTOR}\\:txt { color: hsl(${H}, ${S}%, ${90}%) }`)
49+
lines.push(` html[data-theme='auto'] ${SELECTOR}\\:txt\\:st, html.auto ${SELECTOR}\\:txt\\:st { color: ${HSL} }`)
50+
lines.push(` html[data-theme='auto'] ${SELECTOR}\\:txt\\:rv, html.auto ${SELECTOR}\\:txt\\:rv { color: hsl(${H}, ${S}%, ${10}%) }`)
51+
lines.push(`}`)
52+
53+
return lines.join('\n')
54+
}

0 commit comments

Comments
 (0)