question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: ion-datetime color customization issues

See original GitHub issue

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

In our project we are providing a light and dark theme. The ion-datetime is using the CSS var --ion-color-step-300 to define the font color for the day of week part in the area of the calendar and for the background color in the time picker area. This leads to the problem that the time for the dark theme is no longer displayed legibly. Furthermore we ran into a contrast problem where we are not able to meet some accessibility requirements.

ion-datetime with our light theme applied:

ion-datetime-light-mode

ion-datetime with our dark theme applied:

ion-datetime-dark-mode

Expected Behavior

It would help if the ion-datetime component supports some additional CSS vars which could be set by the consumer. There should be one CSS var to set the color of the “day of the week” part and another to set the background for the time picker separately.

I thought that with this issue I would first ask if there is another option for my use case and if at all I can create a PR to fix the “problem” we have.

Steps to Reproduce

If I change the CSS variable accordingly, the font color for the area in the calendar also changes. Which is not always the best way to do it.

ion-datetime with our dark theme applied and a different color definition for ion-color-step-300:

ion-datetime-dark-mode-custom

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.19.0 (/Users/sandra/.nvm/versions/node/v16.13.0/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 6.1.13 @angular-devkit/build-angular : 13.2.3 @angular-devkit/schematics : 13.2.3 @angular/cli : 13.2.3 @ionic/angular-toolkit : 6.1.0

Utility:

cordova-res : not installed globally native-run : 1.5.0

System:

NodeJS : v16.13.0 (/Users/sandra/.nvm/versions/node/v16.13.0/bin/node) npm : 8.1.0 OS : macOS Monterey

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
sandrafreihofercommented, Jul 13, 2022

@liamdebeasi After debugging and checking how the ion-datetime component is implemented, I found out that the original problem is rather that we don’t have definitions for stepped colors in our theme. I think by setting these additional colors we can solve our use case.

Please excuse the creation of this issue, I initially thought that the problem was on Ionic’s side. Let’s close it.

0reactions
ionitron-bot[bot]commented, Aug 12, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ion-datetime - Ionic Framework
With the isDateEnabled property, developers can customize the ion-datetime to disable a specific day, range of dates, weekends or any custom rule using...
Read more >
How to solve ionic datetime window color issue - Stack Overflow
Try this in the template: <ion-item class="force-black-font"> <ion-label>Date of birth</ion-label> <ion-datetime displayFormat="MMM DD YYYY" ...
Read more >
Ionic 6 ion-datetime | Complete guide - YouTube
Hello Friends, Welcome Back to @CodingTechnyks. In this video, we are going to work with Ionic 6 ion - datetime using​ #ionic #angular...
Read more >
Date picker popup in Ionic 6 | Damir's Corner
One question... do you know if there is any documentation on what CSS variables/selectors can be set for the ion-datetime component. The ionic ......
Read more >
Ionic4 Datepicker Component by Logistic Infotech
Want to use different color schema? please put css as below example to affect only inside datepicker modal. Basically you can override all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found