ionic-team / ionic-team/ionic-framework

bug: Theme Step Colors are Only Defined for DARK Mode

Aperta
#29,965 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
triage
Lingua principale
TypeScript
Stelle
52.7k
Fork
13.3k
Merge medio
1g 15h
PR unite (30g)
51

Descrizione

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v7.x, v8.x

### Current Behavior

If an Ionic app has DARK mode active, there are "step" color variables defined, which are named "--ion-background-color-step-50", "--ion-background-color-step-100", etc., up to "--ion-background-color-step-950". Also there are contrasting "step" colors for text named "--ion-text-color-step-50", etc.

These step colors work as expected in DARK mode. However, if the app is put into LIGHT mode, these variables are not defined at all. This results in plain white for any color CSS attribute that tries to use them in LIGHT mode.

### Expected Behavior

The "step" color definitions should work both in LIGHT mode and DARK mode, although the definitions for LIGHT mode should be the inverse of dark mode. That is, the "--ion-background-color-step-100" for LIGHT mode should be the same value as the "--ion-background-color-step-900" for DARK mode.

### Steps to Reproduce

1. Place some CSS into an Ionic app that references a "step" color, such as:
```
.my-class {
background-color: var(--ion-background-color-step-750);
color: var(--ion-text-color-step-750);
}
```
2. Run the Ionic app using the LIGHT theme.
3. You would expect a medium-dark gray background and a light gray text, but instead you get pure white.
4. If you switch the app to the DARK them, then it will work.

### Code Reproduction URL

https://github.com/ejohanson-vi3/step-colors

### Ionic Info

Ionic:

Ionic CLI : 7.2.0 (C:\local\nodejs\node_modules\@ionic\cli)
Ionic Framework : @ionic/vue 8.2.0

Capacitor:

Capacitor CLI : 6.0.0
@capacitor/android : 6.0.0
@capacitor/core : 6.0.0
@capacitor/ios : 6.0.0

Utility:

cordova-res : 0.15.4
native-run : 2.0.1

System:

NodeJS : v20.14.0 (C:\local\nodejs\node.exe)
npm : 10.8.1
OS : Windows 10

### Additional Information

As a workaround, a project can add the following to the `theme/variables.css` file. However, this just uses the Android MD colors, and does not differentiate between iOS and MD platforms (the definitions in the Ionic source code have slightly different color values for iOS and MD in DARK mode).
```
:root {
--ion-background-color-step-950: #1e1e1e;
--ion-background-color-step-900: #2a2a2a;
--ion-background-color-step-850: #363636;
--ion-background-color-step-800: #414141;
--ion-background-color-step-750: #4d4d4d;
--ion-background-color-step-700: #595959;
--ion-background-color-step-650: #656565;
--ion-background-color-step-600: #717171;
--ion-background-color-step-550: #7d7d7d;
--ion-background-color-step-500: #898989;
--ion-background-color-step-450: #949494;
--ion-background-color-step-400: #a0a0a0;
--ion-background-color-step-350: #acacac;
--ion-background-color-step-300: #b8b8b8;
--ion-background-color-step-250: #c4c4c4;
--ion-background-color-step-200: #d0d0d0;
--ion-background-color-step-150: #dbdbdb;
--ion-background-color-step-100: #e7e7e7;
--ion-background-color-step-50: #f3f3f3;
--ion-text-color-step-950: #f3f3f3;
--ion-text-color-step-900: #e7e7e7;
--ion-text-color-step-850: #dbdbdb;
--ion-text-color-step-800: #d0d0d0;
--ion-text-color-step-750: #c4c4c4;
--ion-text-color-step-700: #b8b8b8;
--ion-text-color-step-650: #acacac;
--ion-text-color-step-600: #a0a0a0;
--ion-text-color-step-550: #949494;
--ion-text-color-step-500: #898989;
--ion-text-color-step-450: #7d7d7d;
--ion-text-color-step-400: #717171;
--ion-text-color-step-350: #656565;
--ion-text-color-step-300: #595959;
--ion-text-color-step-250: #4d4d4d;
--ion-text-color-step-200: #414141;
--ion-text-color-step-150: #363636;
--ion-text-color-step-100: #2a2a2a;
--ion-text-color-step-50: #1e1e1e;
}
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.