Skip to content

Commit b56e473

Browse files
committed
refactor(theme): remove rgb option
1 parent 7555cef commit b56e473

1 file changed

Lines changed: 5 additions & 17 deletions

File tree

core/src/utils/theme.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ export function rgba(colorRgb: string, alpha: number | string): string {
595595
return `rgba(${colorRgb}, ${alpha})`;
596596
}
597597

598-
interface CurrentColorOptions {
598+
interface ColorOptions {
599599
alpha?: number | string | null;
600600
subtle?: boolean;
601601
}
@@ -609,7 +609,7 @@ interface CurrentColorOptions {
609609
* @param subtle If true, uses the '--ion-color-subtle-' prefix.
610610
* @returns A string containing the CSS value (e.g., 'var(--ion-color-primary)' or 'rgba(var(--ion-color-primary-rgb), 0.16)').
611611
*/
612-
export function currentColor(variation: string, options: CurrentColorOptions = {}): string {
612+
export function currentColor(variation: string, options: ColorOptions = {}): string {
613613
const { alpha = null, subtle = false } = options;
614614

615615
// 1. Determine the base CSS variable name
@@ -629,19 +629,13 @@ export function currentColor(variation: string, options: CurrentColorOptions = {
629629
return `rgba(var(${variable}-rgb), ${alpha})`;
630630
}
631631

632-
interface IonColorOptions {
633-
alpha?: number | string | null;
634-
rgb?: boolean;
635-
subtle?: boolean;
636-
}
637-
638-
export function ionColor(name: string, variation: string, options: IonColorOptions = {}): string {
639-
const { alpha = null, rgb = false, subtle = false } = options;
632+
export function ionColor(name: string, variation: string, options: ColorOptions = {}): string {
633+
const { alpha = null, subtle = false } = options;
640634

641635
// Build base variable name
642636
const base = subtle ? `--ion-color-${name}-subtle` : `--ion-color-${name}`;
643637
const variationSuffix = variation === 'base' ? '' : `-${variation}`;
644-
let variable = `${base}${variationSuffix}`;
638+
const variable = `${base}${variationSuffix}`;
645639

646640
// Build the fallback variable name (only for bold colors)
647641
let fallbackVariable: string | null = null;
@@ -659,12 +653,6 @@ export function ionColor(name: string, variation: string, options: IonColorOptio
659653
return fallbackRgb ? `rgba(var(${rgbVar}, var(${fallbackRgb})), ${alpha})` : `rgba(var(${rgbVar}), ${alpha})`;
660654
}
661655

662-
// Handle RGB variables
663-
if (rgb) {
664-
variable = `${variable}-rgb`;
665-
fallbackVariable = fallbackVariable ? `${fallbackVariable}-rgb` : null;
666-
}
667-
668656
return fallbackVariable ? `var(${variable}, var(${fallbackVariable}))` : `var(${variable})`;
669657
}
670658

0 commit comments

Comments
 (0)