ultralytics 8.0.210 docs updates and bug fixes (#6365)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: Ceyda Cinarel (재이다) <15624271+cceyda@users.noreply.github.com> Co-authored-by: DennisJ <106725464+DennisJcy@users.noreply.github.com> Co-authored-by: Dickson Neoh <dickson.neoh@gmail.com> Co-authored-by: Sergiu Waxmann <47978446+sergiuwaxmann@users.noreply.github.com> Co-authored-by: Luca Serra <56681681+luca-serra@users.noreply.github.com>
This commit is contained in:
parent
9a5891444e
commit
0473da00a9
18 changed files with 125 additions and 57 deletions
|
|
@ -16,8 +16,18 @@ const applyAutoTheme = () => {
|
|||
|
||||
// Function that checks and applies light/dark theme based on the user's preference (if auto theme is enabled)
|
||||
function checkAutoTheme() {
|
||||
// Retrieve the palette from local storage
|
||||
const palette = localStorage.getItem("/.__palette");
|
||||
// Array of supported language codes -> each language has its own palette (stored in local storage)
|
||||
const supportedLangCodes = ["en", "zh", "ko", "ja", "ru", "de", "fr", "es", "pt"];
|
||||
// Get the URL path
|
||||
const path = window.location.pathname;
|
||||
// Extract the language code from the URL (assuming it's in the format /xx/...)
|
||||
const langCode = path.split("/")[1];
|
||||
// Check if the extracted language code is in the supported languages
|
||||
const isValidLangCode = supportedLangCodes.includes(langCode);
|
||||
// Construct the local storage key based on the language code if valid, otherwise default to the root key
|
||||
const localStorageKey = isValidLangCode ? `/${langCode}/.__palette` : "/.__palette";
|
||||
// Retrieve the palette from local storage using the constructed key
|
||||
const palette = localStorage.getItem(localStorageKey);
|
||||
if (palette) {
|
||||
// Check if the palette's index is 0 (auto theme)
|
||||
const paletteObj = JSON.parse(palette);
|
||||
|
|
@ -26,9 +36,11 @@ function checkAutoTheme() {
|
|||
}
|
||||
}
|
||||
}
|
||||
// ! No need to run the function when the script loads as by default the theme is determined by the user's preference (if auto theme is enabled)
|
||||
// checkAutoTheme();
|
||||
// Run the function when the user's preference changes (when the user changes their system theme)
|
||||
|
||||
// Run function when the script loads
|
||||
checkAutoTheme();
|
||||
|
||||
// Re-run the function when the user's preference changes (when the user changes their system theme)
|
||||
window.matchMedia("(prefers-color-scheme: light)").addEventListener("change", checkAutoTheme);
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", checkAutoTheme);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,41 +1,42 @@
|
|||
/* Table format like GitHub ----------------------------------------------------------------------------------------- */
|
||||
th, td {
|
||||
border: 1px solid var(--md-typeset-table-color);
|
||||
border-spacing: 0;
|
||||
border-bottom: none;
|
||||
border-left: none;
|
||||
border-top: none;
|
||||
th,
|
||||
td {
|
||||
border: 1px solid var(--md-typeset-table-color);
|
||||
border-spacing: 0;
|
||||
border-bottom: none;
|
||||
border-left: none;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.md-typeset__table {
|
||||
line-height: 1;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.md-typeset__table table:not([class]) {
|
||||
font-size: .74rem;
|
||||
border-right: none;
|
||||
font-size: 0.74rem;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.md-typeset__table table:not([class]) td,
|
||||
.md-typeset__table table:not([class]) th {
|
||||
padding: 9px;
|
||||
padding: 9px;
|
||||
}
|
||||
|
||||
/* light mode alternating table bg colors */
|
||||
.md-typeset__table tr:nth-child(2n) {
|
||||
background-color: #f8f8f8;
|
||||
background-color: #f6f8fa;
|
||||
}
|
||||
|
||||
/* dark mode alternating table bg colors */
|
||||
body.md-theme--slate .md-typeset__table tr:nth-child(2n) {
|
||||
background-color: hsla(207, 26%, 17%, 1);
|
||||
[data-md-color-scheme="slate"] .md-typeset__table tr:nth-child(2n) {
|
||||
background-color: #161b22;
|
||||
}
|
||||
/* Table format like GitHub ----------------------------------------------------------------------------------------- */
|
||||
|
||||
/* Code block vertical scroll */
|
||||
div.highlight {
|
||||
max-height: 20rem;
|
||||
overflow-y: auto; /* for adding a scrollbar when needed */
|
||||
max-height: 20rem;
|
||||
overflow-y: auto; /* for adding a scrollbar when needed */
|
||||
}
|
||||
|
||||
/* Set content width */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue