Skip to content

Configurable accent color + dark-mode support for the picker - #92

Merged
Fivell merged 1 commit into
masterfrom
feature/configurable-accent-and-dark
Oct 7, 2026
Merged

Fivell merged 1 commit into
masterfrom
feature/configurable-accent-and-dark

Conversation

@Fivell

@Fivell Fivell commented Oct 7, 2026

Copy link
Copy Markdown
Member

Problem

The vendored XDSoft stylesheet (app/assets/stylesheets/vendor/jquery.datetimepicker.css) hardcodes a bright blue #33aaff on:

  • the selected option in the month/year/time dropdown (.xdsoft_option.xdsoft_current)
  • the selected/current day and current time slot (td.xdsoft_current, .xdsoft_time_box ... .xdsoft_current)
  • "today" (td.xdsoft_today, a text color)
  • the disabled-current hover variant (!important)

There is no SCSS variable for it, so consuming apps have had to !important-override the xdsoft classes just to recolor the picker, and there was no way to make the picker follow a dark theme.

Changes

All changes live in the gem's own stylesheet (app/assets/stylesheets/active_admin_datetimepicker.scss) — the vendored upstream CSS is untouched.

1. Configurable accent color

$aa-datetimepicker-accent-color: #33aaff !default;

The variable defaults to the original #33aaff, so existing users see no change. Set it before importing the gem to recolor the selected/current backgrounds, the "today" text color and the disabled-current hover variant in one place.

2. Dark mode

The picker now follows the host's dark theme using the same triggers as the sibling active_admin_theme gem: the OS prefers-color-scheme: dark preference and an explicit html[data-theme="dark"], with a html[data-theme="light"] escape so a pinned-light page stays light.

Rather than invent new dark styles, it reuses XDSoft's built-in .xdsoft_dark skin, re-scoped onto .xdsoft_datetimepicker directly (the picker is appended to <body>, so it can never carry the .xdsoft_dark class on its own).

3. README

Documents the new variable and the dark-mode behavior.

Verification

Compiled the stylesheet with sassc (same compiler the asset pipeline uses), stubbing the two ActiveAdmin variables the file expects — compiles with no error, and the output contains the default blue, the dark-skin colors, and both dark triggers.

The vendored XDSoft stylesheet hardcodes a bright blue (#33aaff) on the
selected/current day, the current time slot and 'today', with no variable
to override it, forcing host apps into !important overrides.

Add a gem-owned override (not touching the vendored upstream CSS):
- Expose $aa-datetimepicker-accent-color (!default, defaults to the original
  #33aaff so existing apps are unaffected) applied to the current/selected
  backgrounds, the 'today' text color and the disabled-current hover variant.
- Follow the host dark theme using the same triggers as active_admin_theme
  (prefers-color-scheme: dark and html[data-theme=dark], with a
  [data-theme=light] escape) by re-scoping XDSoft's built-in .xdsoft_dark skin
  onto .xdsoft_datetimepicker.

Document both in the README.
@Fivell
Fivell merged commit cf10c87 into master Oct 7, 2026
25 checks passed
@Fivell
Fivell deleted the feature/configurable-accent-and-dark branch October 7, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant