diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ca94e4..8c174e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Fixed broken color styles ([#405](https://github.com/tailwindlabs/tailwindcss-typography/pull/405)) ## [0.5.18] - 2025-09-19 diff --git a/src/styles.js b/src/styles.js index 5371223..f563dab 100644 --- a/src/styles.js +++ b/src/styles.js @@ -14,14 +14,16 @@ const opacity = (color, opacity) => { // values. let hex = color.replace('#', '') hex = hex.length === 3 ? hex.replace(/./g, '$&$&') : hex - const r = parseInt(hex.substring(0, 2), 16) - const g = parseInt(hex.substring(2, 4), 16) - const b = parseInt(hex.substring(4, 6), 16) + + let r = parseInt(hex.substring(0, 2), 16) + let g = parseInt(hex.substring(2, 4), 16) + let b = parseInt(hex.substring(4, 6), 16) if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) { return `color-mix(in oklab, ${color} ${opacity}, transparent)` } - return `rgb(${r}, ${g}, ${b} / ${opacity})` + + return `rgb(${r} ${g} ${b} / ${opacity})` } let defaultModifiers = {