Skip to content

Commit ace4e19

Browse files
authored
[IDISPLAY] Implementing the dark mode (#1304)
Should close:
1 parent e964475 commit ace4e19

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

verticapy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
__license__: str = "Apache License, Version 2.0"
3939
__version__: str = "1.1.0-beta"
4040
__iteration__: int = 1
41-
__date__: str = "10052024"
41+
__date__: str = "10072024"
4242
__last_commit__: str = "a58bb45bb5a8e491e36b14a7346a730206c1c821"
4343
__long_version__: str = f"{__version__}-{__iteration__}{__date__}-{__last_commit__}"
4444
__codecov__: float = 0.84

verticapy/jupyter/_javascript.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ def datatables_repr(
246246
Returns the HTML/javascript
247247
representation of the table.
248248
"""
249+
theme = conf.get_option("theme")
249250
dtype = format_type(dtype, dtype=dict)
250251
if not repeat_first_column:
251252
index_column = list(range(1 + offset, len(data_columns[0]) + offset))
@@ -277,11 +278,17 @@ def datatables_repr(
277278
table_header,
278279
)
279280
output = replace_value(output, "#table_id", f"#{tableId}", 2)
281+
if theme == "dark":
282+
style = read_package_file("html/style-dark.css")
283+
elif theme == "sphinx":
284+
style = read_package_file("html/style.css")
285+
else:
286+
style = read_package_file("html/style.css")
280287
output = replace_value(
281288
output,
282289
"<style></style>",
283290
f"""<style>
284-
{read_package_file("html/style.css")}
291+
{style}
285292
</style>""",
286293
)
287294
dt_data = json.dumps(data, cls=DateTimeEncoder)

verticapy/jupyter/html/style-dark.css

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
table td {
2+
text-overflow: ellipsis;
3+
overflow: hidden;
4+
text-align: center !important;
5+
background-color: #18181A;
6+
white-space: nowrap !important;
7+
color: #FFFFCC;
8+
}
9+
10+
table tr:nth-child(1) {
11+
background-color: #000000;
12+
color: #FFFFFF;
13+
}
14+
15+
table th {
16+
text-overflow: ellipsis;
17+
overflow: hidden;
18+
text-align: center !important;
19+
}
20+
21+
tr td:nth-child(1) {
22+
border: 1px solid #555555;
23+
background-color: #000000;
24+
color: #1A6AFF;
25+
min-width: 95px;
26+
max-width: 95px;
27+
}
28+
29+
tr td:nth-child(n+2) {
30+
border: 1px solid #333333;
31+
max-width: 240px;
32+
}
33+
34+
thead input {
35+
width: 100%;
36+
padding: 3px;
37+
box-sizing: border-box;
38+
}
39+
40+
table thead tr td {
41+
background-color: #000000;
42+
color: #FFFFFF;
43+
}
44+
45+
table.dataTable thead>tr>th.sorting:before,table.dataTable thead>tr>th.sorting_asc:before,table.dataTable thead>tr>th.sorting_desc:before,table.dataTable thead>tr>th.sorting_asc_disabled:before,table.dataTable thead>tr>th.sorting_desc_disabled:before,table.dataTable thead>tr>td.sorting:before,table.dataTable thead>tr>td.sorting_asc:before,table.dataTable thead>tr>td.sorting_desc:before,table.dataTable thead>tr>td.sorting_asc_disabled:before,table.dataTable thead>tr>td.sorting_desc_disabled:before {
46+
bottom: 50%;
47+
content: "▴";
48+
font-size: x-large !important;
49+
}
50+
51+
table.dataTable thead>tr>th.sorting:after,table.dataTable thead>tr>th.sorting_asc:after,table.dataTable thead>tr>th.sorting_desc:after,table.dataTable thead>tr>th.sorting_asc_disabled:after,table.dataTable thead>tr>th.sorting_desc_disabled:after,table.dataTable thead>tr>td.sorting:after,table.dataTable thead>tr>td.sorting_asc:after,table.dataTable thead>tr>td.sorting_desc:after,table.dataTable thead>tr>td.sorting_asc_disabled:after,table.dataTable thead>tr>td.sorting_desc_disabled:after {
52+
top: 50%;
53+
content: "▾";
54+
font-size: x-large !important;
55+
}

0 commit comments

Comments
 (0)