Loading...
 
Skip to main content

Date picker background colors don't correctly match the theme (especially custom themes)

Status
Closed
Subject
Date picker background colors don't correctly match the theme (especially custom themes)
Version
27.x
master
Category
  • Regression
  • Usability
Feature
Article
Calendar
Trackers
Resolution status
New
Submitted by
Gary Cunningham-Lee
Lastmod by
Gary Cunningham-Lee
Rating
(0)
Description

The styles of the "button" of the date picker (or whatever it's called - the place you click to display the selector for the date and time) such as the font and colors are set dynamically to match the theme being used. This works for the themes in the themes directory, but this doesn't work completely for custom themes.

For example, I have a custom light-on-dark theme with a body background color of #0c0d16 (almost black) and a .form-control background color of #343a40 (also very dark), but the background color of the date picker's "button" (div.dp__main dp__theme_light) is very light so clearly isn't getting the background color information correctly from the theme stylesheet. In a non-custom dark theme like Slate, I can see the button display with a light background for an instant and then get the correct dark background color to match the Slate theme, but for custom themes this switch doesn't happen, in my experience.

On the other hand, the date picker is using the right font, as specified by the custom theme, so there's partial success here.

I tested with the Switch Color Mode not active and with it active and set to both light and dark and the date picker button background was never correct. A workaround would be to add a CSS rule to the custom theme to correct the background color, but it would be nice if it worked automatically as it does for the themes in the themes directory.

Actually, now that I look again, it appears that the background color for the popup (with date and time selectors) isn't correct for non-custom themes, either. Using the Slate theme, which has a dark background color, the date picker popup has a light background with light text. This bad contrast is maybe due to the correct text color but wrong background color being used.

Also, the selector and popup backgrounds aren't sensitive to Color Mode switching.

Hopefully the same fix for these issues will work for both custom and standard themes.

Solution
The problem was fixed by adding the Bootstrap body background CSS variable to the datetime-picker's src custom.scss file so now, after compiling, the body background color is also used for the dropdown.
Workaround
Importance
8
Easy to solve?
5
Priority
40
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
8641
Created
Monday 24 June, 2024 01:35:27 UTC
by Gary Cunningham-Lee
LastModif
Tuesday 08 October, 2024 14:13:53 UTC


Show PHP error messages