Skip to content

Commit

Permalink
New: Dark mode support for DateTime picker. Enabled by adding the cla…
Browse files Browse the repository at this point in the history
…ss `dark` to the `html` element
  • Loading branch information
AllanJard committed Jun 2, 2023
1 parent 99c7081 commit 5044cb3
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 33 deletions.
130 changes: 115 additions & 15 deletions css/dataTables.dateTime.scss
Expand Up @@ -7,8 +7,9 @@ div.dt-datetime {
z-index: 2050;
border: 1px solid #ccc;
box-shadow: 0 5px 15px -5px rgba(0,0,0,.5);
padding: 0 20px 6px 20px;
padding: 6px 20px;
width: 275px;
border-radius: 5px;

&.inline {
position: relative;
Expand Down Expand Up @@ -195,16 +196,15 @@ div.dt-datetime {


div.dt-datetime-iconLeft,
div.dt-datetime-iconRight,
div.dt-datetime-iconUp,
div.dt-datetime-iconDown {
div.dt-datetime-iconRight {
width: 30px;
height: 30px;
background-position: center;
background-repeat: no-repeat;
opacity: 0.3;
overflow: hidden;
box-sizing: border-box;
border: 1px solid transparent;

&:hover {
border: 1px solid #ccc;
Expand All @@ -227,24 +227,44 @@ div.dt-datetime {
position: absolute;
top: 5px;
left: 5px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAUklEQVR42u3VMQoAIBADQf8Pgj+OD9hG2CtONJB2ymQkKe0HbwAP0xucDiQWARITIDEBEnMgMQ8S8+AqBIl6kKgHiXqQqAeJepBo/z38J/U0uAHlaBkBl9I4GwAAAABJRU5ErkJggg==');

button {
position: relative;
z-index: 1;
}

&:after {
position: absolute;
top: 7px;
left: 10px;
display: block;
content: "";
border-top: 7px solid transparent;
border-right: 7px solid black;
border-bottom: 7px solid transparent;
}
}

div.dt-datetime-iconRight {
position: absolute;
top: 5px;
right: 5px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAU0lEQVR42u3VOwoAMAgE0dwfAnNjU26bYkBCFGwfiL9VVWoO+BJ4Gf3gtsEKKoFBNTCoCAYVwaAiGNQGMUHMkjGbgjk2mIONuXo0nC8XnCf1JXgArVIZAQh5TKYAAAAASUVORK5CYII=');
}

div.dt-datetime-iconUp {
height: 20px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAALCAMAAABf9c24AAAAFVBMVEX///99fX1+fn57e3t6enoAAAAAAAC73bqPAAAABnRSTlMAYmJkZt92bnysAAAAL0lEQVR4AWOgJmBhxCvLyopHnpmVjY2VCadeoCxIHrcsWJ4RlyxCHlMWCTBRJxwAjrIBDMWSiM0AAAAASUVORK5CYII=');
}
button {
position: relative;
z-index: 1;
}

div.dt-datetime-iconDown {
height: 20px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAALCAMAAABf9c24AAAAFVBMVEX///99fX1+fn57e3t6enoAAAAAAAC73bqPAAAABnRSTlMAYmJkZt92bnysAAAAMElEQVR4AWOgDmBiRQIsmPKMrGxQgJDFlEfIYpoPk8Utz8qM232MYFfhkQfKUg8AANefAQxecJ58AAAAAElFTkSuQmCC');
&:after {
position: absolute;
top: 7px;
left: 12px;
display: block;
content: "";
border-top: 7px solid transparent;
border-left: 7px solid black;
border-bottom: 7px solid transparent;
}
}
}

Expand All @@ -256,4 +276,84 @@ div.dt-datetime-error {
line-height: 1.25em;
text-align: center;
color: #b11f1f;
}
}


html.dark {
div.dt-datetime {
border: 1px solid rgb(89, 91, 94);
background-color: rgb(33, 37, 41);
box-shadow: 3px 4px 10px 1px rgba(0, 0, 0, 0.8);

table {
th {
color: #ccc;
}

td {
color: #eee;
}

td.selectable {
background: rgb(55, 60, 65);

&.disabled {
color: #aaa;
background: rgb(23, 27, 31);

button:hover {
color: #aaa;
background: rgb(23, 27, 31);
}
}

&.now {
background-color: #ddd;
}

&.selected button {
background: rgb(110, 168, 254);
color: black;
}

button:hover {
background: #ff8000;
color: black;
}
}
}

div.dt-datetime-label {
&:hover {
border: 1px solid transparent;
background-color: rgba(255, 255, 255, 0.1);
}
}

div.dt-datetime-iconLeft,
div.dt-datetime-iconRight,
div.dt-datetime-iconUp,
div.dt-datetime-iconDown {
&:hover {
border: 1px solid transparent;
background-color: rgba(255, 255, 255, 0.1);
}
}

div.dt-datetime-iconLeft {
&:after {
border-right-color: white;
}
}

div.dt-datetime-iconRight {
&:after {
border-left-color: white;
}
}
}

div.dt-datetime-error {
color: #b11f1f;
}
}
104 changes: 86 additions & 18 deletions dist/dataTables.dateTime.css
Expand Up @@ -4,8 +4,9 @@ div.dt-datetime {
z-index: 2050;
border: 1px solid #ccc;
box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.5);
padding: 0 20px 6px 20px;
padding: 6px 20px;
width: 275px;
border-radius: 5px;
}
div.dt-datetime.inline {
position: relative;
Expand Down Expand Up @@ -155,30 +156,25 @@ div.dt-datetime div.dt-datetime-time div.dt-datetime-timeblock {
vertical-align: middle;
}
div.dt-datetime div.dt-datetime-iconLeft,
div.dt-datetime div.dt-datetime-iconRight,
div.dt-datetime div.dt-datetime-iconUp,
div.dt-datetime div.dt-datetime-iconDown {
div.dt-datetime div.dt-datetime-iconRight {
width: 30px;
height: 30px;
background-position: center;
background-repeat: no-repeat;
opacity: 0.3;
overflow: hidden;
box-sizing: border-box;
border: 1px solid transparent;
}
div.dt-datetime div.dt-datetime-iconLeft:hover,
div.dt-datetime div.dt-datetime-iconRight:hover,
div.dt-datetime div.dt-datetime-iconUp:hover,
div.dt-datetime div.dt-datetime-iconDown:hover {
div.dt-datetime div.dt-datetime-iconRight:hover {
border: 1px solid #ccc;
border-radius: 2px;
background-color: #f0f0f0;
opacity: 0.6;
}
div.dt-datetime div.dt-datetime-iconLeft button,
div.dt-datetime div.dt-datetime-iconRight button,
div.dt-datetime div.dt-datetime-iconUp button,
div.dt-datetime div.dt-datetime-iconDown button {
div.dt-datetime div.dt-datetime-iconRight button {
border: none;
background: transparent;
text-indent: 30px;
Expand All @@ -190,21 +186,39 @@ div.dt-datetime div.dt-datetime-iconLeft {
position: absolute;
top: 5px;
left: 5px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAUklEQVR42u3VMQoAIBADQf8Pgj+OD9hG2CtONJB2ymQkKe0HbwAP0xucDiQWARITIDEBEnMgMQ8S8+AqBIl6kKgHiXqQqAeJepBo/z38J/U0uAHlaBkBl9I4GwAAAABJRU5ErkJggg==");
}
div.dt-datetime div.dt-datetime-iconLeft button {
position: relative;
z-index: 1;
}
div.dt-datetime div.dt-datetime-iconLeft:after {
position: absolute;
top: 7px;
left: 10px;
display: block;
content: "";
border-top: 7px solid transparent;
border-right: 7px solid black;
border-bottom: 7px solid transparent;
}
div.dt-datetime div.dt-datetime-iconRight {
position: absolute;
top: 5px;
right: 5px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAU0lEQVR42u3VOwoAMAgE0dwfAnNjU26bYkBCFGwfiL9VVWoO+BJ4Gf3gtsEKKoFBNTCoCAYVwaAiGNQGMUHMkjGbgjk2mIONuXo0nC8XnCf1JXgArVIZAQh5TKYAAAAASUVORK5CYII=");
}
div.dt-datetime div.dt-datetime-iconUp {
height: 20px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAALCAMAAABf9c24AAAAFVBMVEX///99fX1+fn57e3t6enoAAAAAAAC73bqPAAAABnRSTlMAYmJkZt92bnysAAAAL0lEQVR4AWOgJmBhxCvLyopHnpmVjY2VCadeoCxIHrcsWJ4RlyxCHlMWCTBRJxwAjrIBDMWSiM0AAAAASUVORK5CYII=");
div.dt-datetime div.dt-datetime-iconRight button {
position: relative;
z-index: 1;
}
div.dt-datetime div.dt-datetime-iconDown {
height: 20px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAALCAMAAABf9c24AAAAFVBMVEX///99fX1+fn57e3t6enoAAAAAAAC73bqPAAAABnRSTlMAYmJkZt92bnysAAAAMElEQVR4AWOgDmBiRQIsmPKMrGxQgJDFlEfIYpoPk8Utz8qM232MYFfhkQfKUg8AANefAQxecJ58AAAAAElFTkSuQmCC");
div.dt-datetime div.dt-datetime-iconRight:after {
position: absolute;
top: 7px;
left: 12px;
display: block;
content: "";
border-top: 7px solid transparent;
border-left: 7px solid black;
border-bottom: 7px solid transparent;
}

div.dt-datetime-error {
Expand All @@ -215,4 +229,58 @@ div.dt-datetime-error {
line-height: 1.25em;
text-align: center;
color: #b11f1f;
}

html.dark div.dt-datetime {
border: 1px solid #595b5e;
background-color: #212529;
box-shadow: 3px 4px 10px 1px rgba(0, 0, 0, 0.8);
}
html.dark div.dt-datetime table th {
color: #ccc;
}
html.dark div.dt-datetime table td {
color: #eee;
}
html.dark div.dt-datetime table td.selectable {
background: #373c41;
}
html.dark div.dt-datetime table td.selectable.disabled {
color: #aaa;
background: #171b1f;
}
html.dark div.dt-datetime table td.selectable.disabled button:hover {
color: #aaa;
background: #171b1f;
}
html.dark div.dt-datetime table td.selectable.now {
background-color: #ddd;
}
html.dark div.dt-datetime table td.selectable.selected button {
background: #6ea8fe;
color: black;
}
html.dark div.dt-datetime table td.selectable button:hover {
background: #ff8000;
color: black;
}
html.dark div.dt-datetime div.dt-datetime-label:hover {
border: 1px solid transparent;
background-color: rgba(255, 255, 255, 0.1);
}
html.dark div.dt-datetime div.dt-datetime-iconLeft:hover,
html.dark div.dt-datetime div.dt-datetime-iconRight:hover,
html.dark div.dt-datetime div.dt-datetime-iconUp:hover,
html.dark div.dt-datetime div.dt-datetime-iconDown:hover {
border: 1px solid transparent;
background-color: rgba(255, 255, 255, 0.1);
}
html.dark div.dt-datetime div.dt-datetime-iconLeft:after {
border-right-color: white;
}
html.dark div.dt-datetime div.dt-datetime-iconRight:after {
border-left-color: white;
}
html.dark div.dt-datetime-error {
color: #b11f1f;
}

0 comments on commit 5044cb3

Please sign in to comment.