Skip to content

Commit

Permalink
Fix table color (alshedivat#1424)
Browse files Browse the repository at this point in the history
Fix table color when dark mode is default.

---------

Signed-off-by: George Araujo <george.gcac@gmail.com>
  • Loading branch information
george-gca authored and adityarauniyar committed Jan 17, 2024
1 parent 791b24b commit 43004cc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ bootstrap:
integrity:
css: "sha256-DF7Zhf293AJxJNTmh5zhoYYIMs2oXitRfBjY+9L//AY="
js: "sha256-fgLAgv7fyCGopR/gBNq2iW3ZKIdqIcyshnUULC4vex8="
bootstrap-table:
version: "1.21.4"
fontawesome:
version: "5.15.4"
integrity: "sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4="
Expand Down
2 changes: 1 addition & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdbootstrap@{{ site.mdb.version }}/css/mdb.min.css" integrity="{{ site.mdb.integrity.css }}" crossorigin="anonymous" />

<!-- Bootstrap Table -->
<link defer rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.21.3/dist/bootstrap-table.min.css">
<link defer rel="stylesheet" href="https://unpkg.com/bootstrap-table@{{ site.bootstrap-table.version }}/dist/bootstrap-table.min.css">

<!-- Fonts & Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@{{ site.fontawesome.version }}/css/all.min.css" integrity="{{ site.fontawesome.integrity }}" crossorigin="anonymous">
Expand Down
2 changes: 1 addition & 1 deletion _includes/scripts/misc.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% endif %}

<!-- Bootstrap Table -->
<script defer src="https://unpkg.com/bootstrap-table@1.21.3/dist/bootstrap-table.min.js"></script>
<script defer src="https://unpkg.com/bootstrap-table@{{ site.bootstrap-table.version }}/dist/bootstrap-table.min.js"></script>

<!-- Load Common JS -->
<script src="{{ '/assets/js/no_defer.js' | relative_url }}"></script>
Expand Down
5 changes: 4 additions & 1 deletion _sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ table.table a {
}
}

.table-dark {
background-color: transparent;
}

figure,
img {
max-width: 90vw;
Expand Down Expand Up @@ -946,4 +950,3 @@ nav[data-toggle="toc"] {
top: 0;
}
}

12 changes: 6 additions & 6 deletions assets/js/no_defer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// add bootstrap classes to tables
$(document).ready(function() {
$('table').each(function() {
if (document.documentElement.getAttribute("data-theme") == "dark") {
$(this).addClass('table-dark');
} else {
$(this).removeClass('table-dark');
}

// only select tables that are not inside an element with "news" (about page) or "card" (cv page) class
if($(this).parents('[class*="news"]').length==0 &&
$(this).parents('[class*="card"]').length==0 &&
Expand All @@ -10,12 +16,6 @@ $(document).ready(function() {
// add some classes to make the table look better
// $(this).addClass('table-sm');
$(this).addClass('table-hover');

if (document.documentElement.getAttribute("data-theme") == "dark") {
$(this).addClass('table-dark');
} else {
$(this).removeClass('table-dark');
}
}
})
});
Expand Down

0 comments on commit 43004cc

Please sign in to comment.