Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new --rdp-selected-color CSS variable for text of selected days #1931

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/style.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
.rdp {
--rdp-cell-size: 40px;
--rdp-caption-font-size: 18px;
--rdp-accent-color: #0000ff;
--rdp-background-color: #e7edff;
--rdp-accent-color-dark: #3003e1;
--rdp-background-color-dark: #180270;
--rdp-cell-size: 40px; /* Size of the day cells. */
--rdp-caption-font-size: 18px; /* Font size for the caption labels. */
--rdp-accent-color: #0000ff; /* Accent color for the background of selected days. */
--rdp-background-color: #e7edff; /* Background color for the hovered/focused elements. */
--rdp-accent-color-dark: #3003e1; /* Accent color for the background of selected days (to use in dark-mode). */
--rdp-background-color-dark: #180270; /* Background color for the hovered/focused elements (to use in dark-mode). */
--rdp-outline: 2px solid var(--rdp-accent-color); /* Outline border for focused elements */
--rdp-outline-selected: 3px solid var(--rdp-accent-color); /* Outline border for focused _and_ selected elements */
--rdp-selected-color: #fff; /* Color of selected day text */

margin: 1em;
}
Expand Down Expand Up @@ -270,7 +271,7 @@
.rdp-day_selected,
.rdp-day_selected:focus-visible,
.rdp-day_selected:hover {
color: white;
color: var(--rdp-selected-color);
opacity: 1;
background-color: var(--rdp-accent-color);
}
Expand Down
21 changes: 10 additions & 11 deletions website/docs/basics/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ DayPicker comes with for a minimal, lightweight appearance: import `react-day-pi
import 'react-day-picker/dist/style.css';
```

This will add the [DayPicker stylesheet](https://github.com/gpbl/react-day-picker/blob/main/src/style.css#L29) into your app. The stylesheet includes some CSS global variables, to override colors and sizes:
This will add the [DayPicker stylesheet](https://github.com/gpbl/react-day-picker/blob/main/src/style.css) into your app. The stylesheet includes some CSS global variables, to override colors and sizes:

```css
.rdp {
--rdp-cell-size: 40px;
--rdp-accent-color: #0000ff;
--rdp-background-color: #e7edff;
/* Switch to dark colors for dark themes */
--rdp-accent-color-dark: #3003e1;
--rdp-background-color-dark: #180270;
/* Outline border for focused elements */
--rdp-outline: 2px solid var(--rdp-accent-color);
/* Outline border for focused and selected elements */
--rdp-outline-selected: 2px solid rgba(0, 0, 0, 0.75);
--rdp-cell-size: 40px; /* Size of the day cells. */
--rdp-caption-font-size: 18px; /* Font size for the caption labels. */
--rdp-accent-color: #0000ff; /* Accent color for the background of selected days. */
--rdp-background-color: #e7edff; /* Background color for the hovered/focused elements. */
--rdp-accent-color-dark: #3003e1; /* Accent color for the background of selected days (to use in dark-mode). */
--rdp-background-color-dark: #180270; /* Background color for the hovered/focused elements (to use in dark-mode). */
--rdp-outline: 2px solid var(--rdp-accent-color); /* Outline border for focused elements */
--rdp-outline-selected: 3px solid var(--rdp-accent-color); /* Outline border for focused _and_ selected elements */
--rdp-selected-color: #fff; /* Color of selected day text */
}
```

Expand Down