Skip to content

Commit bbb1c21

Browse files
Fix bad RGB syntax (#405)
Fixes #404
1 parent b316f95 commit bbb1c21

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
### Fixed
11+
12+
- Fixed broken color styles ([#405](https://github.com/tailwindlabs/tailwindcss-typography/pull/405))
1113

1214
## [0.5.18] - 2025-09-19
1315

src/styles.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ const opacity = (color, opacity) => {
1414
// values.
1515
let hex = color.replace('#', '')
1616
hex = hex.length === 3 ? hex.replace(/./g, '$&$&') : hex
17-
const r = parseInt(hex.substring(0, 2), 16)
18-
const g = parseInt(hex.substring(2, 4), 16)
19-
const b = parseInt(hex.substring(4, 6), 16)
17+
18+
let r = parseInt(hex.substring(0, 2), 16)
19+
let g = parseInt(hex.substring(2, 4), 16)
20+
let b = parseInt(hex.substring(4, 6), 16)
2021

2122
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
2223
return `color-mix(in oklab, ${color} ${opacity}, transparent)`
2324
}
24-
return `rgb(${r}, ${g}, ${b} / ${opacity})`
25+
26+
return `rgb(${r} ${g} ${b} / ${opacity})`
2527
}
2628

2729
let defaultModifiers = {

0 commit comments

Comments
 (0)