mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge pull request #29220 from omrope79:doc_optimizations_v4
[FOLLOW UP] : Documentation optimizations for the new Sphinx structure #29220 ### Pull Request Readiness Checklist This PR serves as a follow-up to the new documentation system introduced in [#29206](https://github.com/opencv/opencv/pull/29206) Co-authored by: @abhishek-gola @kirtijindal14 @Akansha-977 @Prasadayus @varun-jaiswal17 See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
+384
-15
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
This file is part of OpenCV project.
|
||||
It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
of this distribution and at http://opencv.org/license.html.
|
||||
@@ -55,7 +55,16 @@ html[data-theme="dark"] .bd-article-container a { color: #539bf5 !important; }
|
||||
text-decoration-thickness: 1px;
|
||||
color: #0550ae;
|
||||
}
|
||||
html[data-theme="dark"] .bd-article-container a:hover { color: #6cb6ff !important; }
|
||||
/* Hover keeps the SAME #0969da — no separate hover-blue shade in dark
|
||||
* mode (per "no hover blue, everything at rest"). */
|
||||
html[data-theme="dark"] .bd-article-container a:hover,
|
||||
html[data-theme="dark"] .bd-article-container a.reference:hover,
|
||||
html[data-theme="dark"] .bd-article-container a.reference.internal:hover,
|
||||
html[data-theme="dark"] .bd-article-container a.reference.external:hover,
|
||||
html[data-theme="dark"] .bd-article-container .toctree-wrapper a:hover,
|
||||
html[data-theme="dark"] .bd-article-container li > a:hover {
|
||||
color: #0969da !important;
|
||||
}
|
||||
.bd-content a > code, .bd-content code > a { color: inherit; }
|
||||
|
||||
.bd-content a.opencv-enum-link,
|
||||
@@ -237,8 +246,36 @@ html[data-theme="dark"] table.opencv-meta-table td:last-child { border-right: no
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
}
|
||||
.bd-header .navbar { min-height: 3.25rem; padding-top: 0.25rem; padding-bottom: 0.25rem; }
|
||||
.bd-header .navbar-header-items__start { gap: 1rem; align-items: center; }
|
||||
.bd-header img.logo__image { max-height: 36px; }
|
||||
.bd-header .navbar-header-items__start { gap: 15px; align-items: center; padding-left: 3rem; }
|
||||
/* OpenCV SVG logo: scale the vector to the official proportions. */
|
||||
.bd-header img.logo__image {
|
||||
height: 46px;
|
||||
width: auto;
|
||||
max-width: 50px;
|
||||
object-fit: contain;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.navbar-brand .logo__title {
|
||||
font-weight: 600;
|
||||
font-size: 1.45rem;
|
||||
color: inherit;
|
||||
}
|
||||
/* "OpenCV" wordmark + "Open Source Computer Vision" subtitle stacked in a
|
||||
column to the right of the SVG mark (see _templates/navbar-logo.html). */
|
||||
.navbar-brand.logo .logo__textwrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
line-height: 1.1;
|
||||
}
|
||||
.navbar-brand.logo .logo__textwrap .logo__title { margin: 0; }
|
||||
.navbar-brand.logo .logo__subtitle {
|
||||
margin: 0;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 400;
|
||||
color: var(--pst-color-text-muted);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.version-badge {
|
||||
display: inline-block;
|
||||
@@ -283,17 +320,73 @@ html[data-theme="dark"] table.opencv-meta-table td:last-child { border-right: no
|
||||
.bd-header button.theme-switch-button:hover,
|
||||
.bd-header .navbar-icon-links a.nav-link:hover { color: var(--opencv-accent); }
|
||||
|
||||
/* --- Version switcher dropdown (navbar) -------------------------------- *
|
||||
* Sits in the `navbar_start` slot right after `navbar-logo`. The custom
|
||||
* template `_templates/opencv-version-switcher.html` renders a plain
|
||||
* `<select>`; styles below give it a compact pill shape that reads as a
|
||||
* peer of the wordmark in both light and dark themes. */
|
||||
.opencv-version-switcher {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.opencv-version-switcher #opencv-version-select {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
font: 500 0.85rem/1.2 "Inter", sans-serif;
|
||||
color: var(--pst-color-text-base);
|
||||
background-color: var(--pst-color-surface);
|
||||
border: 1px solid var(--pst-color-border);
|
||||
border-radius: 6px;
|
||||
padding: 0.2rem 1.8rem 0.2rem 0.6rem;
|
||||
/* Dropdown arrow drawn via background SVG so we can colour it via
|
||||
* CSS variables (light/dark) instead of relying on the UA default. */
|
||||
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23656d76' d='M0 0l5 6 5-6z'/></svg>");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 0.55rem center;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
||||
}
|
||||
.opencv-version-switcher #opencv-version-select:hover {
|
||||
border-color: var(--opencv-accent, #0969da);
|
||||
}
|
||||
.opencv-version-switcher #opencv-version-select:focus {
|
||||
outline: none;
|
||||
border-color: var(--opencv-accent, #0969da);
|
||||
box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.25);
|
||||
}
|
||||
html[data-theme="dark"] .opencv-version-switcher #opencv-version-select {
|
||||
color: #e6edf3;
|
||||
background-color: rgba(255, 255, 255, 0.06);
|
||||
border-color: rgba(255, 255, 255, 0.18);
|
||||
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238b949e' d='M0 0l5 6 5-6z'/></svg>");
|
||||
}
|
||||
html[data-theme="dark"] .opencv-version-switcher #opencv-version-select option {
|
||||
background-color: #1c2128;
|
||||
color: #e6edf3;
|
||||
}
|
||||
|
||||
/* --- Wider reading column ---------------------------------------------- */
|
||||
@media (min-width: 960px) {
|
||||
.bd-page-width,
|
||||
.bd-container__inner.bd-page-width { max-width: none !important; }
|
||||
.bd-container { max-width: none !important; }
|
||||
.bd-sidebar-primary { padding-left: 1rem !important; padding-right: 1rem !important; }
|
||||
.bd-sidebar-primary { padding-left: 0.1rem !important; padding-right: 0.75rem !important; }
|
||||
.bd-main .bd-content,
|
||||
.bd-main .bd-article-container { padding-left: 2rem; padding-right: 2rem; }
|
||||
.bd-main .bd-article { padding-left: 0; padding-right: 0; }
|
||||
}
|
||||
|
||||
/* Narrower left section-nav sidebar — the theme default is width:25%, which is
|
||||
~480px on a wide screen (very intrusive). Pin it to a sensible fixed width so
|
||||
the content and the (often wide) diagrams get more room. Desktop only; the
|
||||
mobile off-canvas drawer keeps the theme's own sizing. */
|
||||
@media (min-width: 960px) {
|
||||
.bd-sidebar-primary { width: 16rem; flex: 0 0 16rem; }
|
||||
}
|
||||
|
||||
.bd-sidebar-primary nav.bd-links { margin-right: 0 !important; }
|
||||
.bd-sidebar-primary nav.bd-docs-nav p.bd-links__title {
|
||||
font-size: 0.9rem !important;
|
||||
@@ -356,6 +449,35 @@ div.highlight pre {
|
||||
.highlight .c, .highlight .ch, .highlight .cm,
|
||||
.highlight .cpf, .highlight .c1, .highlight .cs { font-style: normal !important; }
|
||||
|
||||
/* Clickable tokens inside code blocks: force link blue on every
|
||||
* descendant of `<a>` inside `<pre>`. Pygments wraps identifiers in
|
||||
* `<span class="n">…</span>` (or `nc`/`nf`/…) and colours them per
|
||||
* the theme stylesheet — those rules win over the inherited `<a>`
|
||||
* color, so the link text renders as ordinary dark-grey code, not
|
||||
* blue. This rule (high specificity, !important) restores the
|
||||
* theme-link blue across both modes, the same blue we use everywhere
|
||||
* else clickable tokens appear. */
|
||||
div.highlight pre a,
|
||||
div.highlight pre a *,
|
||||
div.highlight pre a span {
|
||||
color: #0969da !important;
|
||||
}
|
||||
html[data-theme="dark"] div.highlight pre a,
|
||||
html[data-theme="dark"] div.highlight pre a *,
|
||||
html[data-theme="dark"] div.highlight pre a span {
|
||||
color: #0969da !important;
|
||||
}
|
||||
div.highlight pre a:hover,
|
||||
div.highlight pre a:hover *,
|
||||
div.highlight pre a:hover span,
|
||||
html[data-theme="dark"] div.highlight pre a:hover,
|
||||
html[data-theme="dark"] div.highlight pre a:hover *,
|
||||
html[data-theme="dark"] div.highlight pre a:hover span {
|
||||
color: #0969da !important;
|
||||
text-decoration: underline !important;
|
||||
text-underline-offset: 0.18em;
|
||||
}
|
||||
|
||||
html[data-theme="dark"] { color-scheme: dark; }
|
||||
html[data-theme="dark"] div.highlight span,
|
||||
html[data-theme="dark"] div.highlight * { color: unset !important; }
|
||||
@@ -388,7 +510,7 @@ html[data-theme="dark"] .highlight .mo { color: #6cb6ff !important; }
|
||||
html[data-theme="dark"] div.highlight pre {
|
||||
background: #2d333b !important;
|
||||
color: #cdd9e5 !important;
|
||||
border-left: 3px solid #539bf5 !important;
|
||||
border-left: 3px solid #0969da !important;
|
||||
}
|
||||
html[data-theme="dark"] code,
|
||||
html[data-theme="dark"] .sig {
|
||||
@@ -566,7 +688,7 @@ html[data-theme="dark"] section[id$="-documentation"] > section > h3 {
|
||||
background: #111622;
|
||||
border-color: #2d3748;
|
||||
}
|
||||
html[data-theme="dark"] section[id$="-documentation"] > section > h3::before { color: #58a6ff; }
|
||||
html[data-theme="dark"] section[id$="-documentation"] > section > h3::before { color: #0969da; }
|
||||
|
||||
section[id$="-documentation"] > section > p,
|
||||
section[id$="-documentation"] > section > ul,
|
||||
@@ -592,6 +714,21 @@ section[id$="-documentation"] > section > p > code {
|
||||
section[id$="-documentation"] > section > p.opencv-api-sig > code {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
/* Clickable type / enum-value tokens inside a member-detail signature: light
|
||||
blue, no underline. The ID-qualified selectors out-specify the per-section
|
||||
`#…-documentation a` colour rules so signature links win everywhere. */
|
||||
.bd-content a.opencv-sig-link,
|
||||
#function-documentation a.opencv-sig-link,
|
||||
#typedef-documentation a.opencv-sig-link {
|
||||
color: #4ea1ff !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
.bd-content a.opencv-sig-link:hover { color: #6cb6ff !important; }
|
||||
html[data-theme="dark"] .bd-content a.opencv-sig-link,
|
||||
html[data-theme="dark"] #function-documentation a.opencv-sig-link,
|
||||
html[data-theme="dark"] #typedef-documentation a.opencv-sig-link {
|
||||
color: #6cb6ff !important;
|
||||
}
|
||||
|
||||
html[data-theme="dark"] section[id$="-documentation"] > section code,
|
||||
html[data-theme="dark"] section[id$="-documentation"] > section code span {
|
||||
@@ -702,6 +839,38 @@ html[data-theme="dark"] button.copybtn.success {
|
||||
button.copybtn { opacity: 1 !important; }
|
||||
}
|
||||
|
||||
/* --- Keep the copy button reachable on tall code blocks ---------------- */
|
||||
/* sphinx-copybutton pins the button (`position: absolute; top`) to the top of
|
||||
its code block, so on a block taller than the viewport — e.g. the long C++
|
||||
sample under group functions like cv::imwrite — it scrolls out of sight the
|
||||
moment you read past the first lines, and the whole button looks "missing".
|
||||
Make it `position: sticky` so it rides along at the top-right of the visible
|
||||
area instead. Hover-reveal behaviour is untouched (no opacity change); the
|
||||
button is still a child of `.highlight`, so `.highlight:hover .copybtn` still
|
||||
fires.
|
||||
Sticky needs NO non-`visible` overflow between the button and the scrolling
|
||||
viewport (the window). Two ancestors set overflow and silently disabled it:
|
||||
the member-detail card (rounded-corner clip) and the theme's
|
||||
`.bd-article-container`. Neither actually scrolls — the window does — so
|
||||
relaxing them is safe; the secondary "On this page" TOC stays sticky
|
||||
(verified). `display:flex` + `order:-1` put the button above <pre> in flow so
|
||||
`top` has something to pin to; the negative bottom margin cancels the
|
||||
button's own box so it overlays the code instead of pushing it down. */
|
||||
div.bd-article-container { overflow: visible !important; }
|
||||
section[id$="-documentation"] > section { overflow: visible !important; }
|
||||
div.highlight { display: flex !important; flex-direction: column; }
|
||||
div.highlight > pre { min-width: 0; } /* let the flex item shrink so overflow-x: auto still scrolls */
|
||||
div.highlight > button.copybtn {
|
||||
order: -1; /* render above <pre> so sticky `top` can pin it */
|
||||
position: sticky;
|
||||
align-self: flex-end; /* hold it at the right edge */
|
||||
margin: 0.5rem 0.5rem -2.35rem 0; /* negative bottom overlays the code, no extra height */
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* --- Class collaboration diagram (.opencv-coll-graph) ------------------ */
|
||||
/* Inlined as <svg> at build-finished (so links work); two theme variants carry
|
||||
the theme's .only-light/.only-dark classes. Size only — no display/filter. */
|
||||
.opencv-coll-graph {
|
||||
display: block;
|
||||
margin: 1rem auto 1.5rem;
|
||||
@@ -716,6 +885,66 @@ html[data-theme="dark"] button.copybtn.success {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Scroll box wrapping every inlined diagram (class collaboration graphs AND the
|
||||
large file include-dependency graphs). The whole graph stays reachable —
|
||||
scrolls when wider/taller than the content area, fits otherwise, never cut. */
|
||||
.opencv-graph-scroll {
|
||||
overflow: auto;
|
||||
max-width: 100%;
|
||||
max-height: 80vh;
|
||||
margin: 1rem 0 1.5rem;
|
||||
text-align: center; /* center a graph narrower than the content area */
|
||||
}
|
||||
.opencv-graph-scroll > svg.opencv-coll-graph {
|
||||
display: block;
|
||||
margin: 0 auto; /* centered when it fits; auto-margins collapse on pan */
|
||||
max-width: none; /* keep natural size so the box can pan a big graph */
|
||||
}
|
||||
|
||||
/* File-page member declaration boxes (parsed-literal). Look like a code block
|
||||
but contain a clickable member name. The `:class:` lands on the <pre>
|
||||
(pre.opencv-decl); guard against a wrapper too (.opencv-decl pre). */
|
||||
pre.opencv-decl,
|
||||
.opencv-decl pre,
|
||||
.opencv-decl {
|
||||
font-family: var(--pst-font-family-monospace);
|
||||
font-size: 0.85em;
|
||||
line-height: 1.5;
|
||||
padding: 0.6rem 0.9rem;
|
||||
margin: 0.25rem 0 0.5rem;
|
||||
border-radius: 0.35rem;
|
||||
overflow-x: auto; /* long signatures scroll, never clip */
|
||||
background-color: var(--pst-color-surface);
|
||||
border: 1px solid var(--pst-color-border);
|
||||
}
|
||||
/* The one real link in the box (the member name): blue, no underline. */
|
||||
pre.opencv-decl a,
|
||||
.opencv-decl a,
|
||||
.opencv-decl a.reference {
|
||||
color: #0969da !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
html[data-theme="dark"] pre.opencv-decl a,
|
||||
html[data-theme="dark"] .opencv-decl a,
|
||||
html[data-theme="dark"] .opencv-decl a.reference { color: #539bf5 !important; }
|
||||
/* --- Clickable enum synopsis (.opencv-enum-synopsis) ------------------- */
|
||||
/* Link colour + no-underline handled by the central enum-links rule near
|
||||
* the top of this file; this block layers explicit dark-mode coverage so
|
||||
* the unified `#0969da` (no hover differentiation) applies even if the
|
||||
* central rule changes. */
|
||||
.opencv-enum-synopsis a.opencv-enum-link {
|
||||
color: #0969da !important;
|
||||
text-decoration: none;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.opencv-enum-synopsis a.opencv-enum-link:hover {
|
||||
color: #0550ae !important;
|
||||
}
|
||||
html[data-theme="dark"] .opencv-enum-synopsis a.opencv-enum-link,
|
||||
html[data-theme="dark"] .opencv-enum-synopsis a.opencv-enum-link:hover {
|
||||
color: #0969da !important;
|
||||
}
|
||||
|
||||
section#member-enumeration-documentation .highlight-cpp .n {
|
||||
color: #0969da !important;
|
||||
}
|
||||
@@ -904,7 +1133,10 @@ html[data-theme="dark"] table.api-reference-table tbody tr td:first-child {
|
||||
|
||||
table.api-reference-table tbody tr td a,
|
||||
table.api-reference-table tbody tr td a:link,
|
||||
table.api-reference-table tbody tr td a:visited {
|
||||
table.api-reference-table tbody tr td a:visited,
|
||||
table.api-reference-table tbody tr td a *,
|
||||
table.api-reference-table tbody tr td a:link *,
|
||||
table.api-reference-table tbody tr td a:visited * {
|
||||
color: var(--pst-color-link, #0969da) !important;
|
||||
text-decoration: none !important;
|
||||
font-weight: 500 !important;
|
||||
@@ -918,12 +1150,22 @@ html[data-theme="dark"] table.api-reference-table tbody tr td a,
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a:link,
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a:visited,
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a:hover,
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a:active {
|
||||
color: #ffffff !important;
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a:active,
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a *,
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a:link *,
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a:visited *,
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a:hover *,
|
||||
html[data-theme="dark"] table.api-reference-table tbody tr td a:active * {
|
||||
color: #0969da !important;
|
||||
}
|
||||
|
||||
table.api-reference-table tbody tr td a code,
|
||||
table.api-reference-table tbody tr td a code *,
|
||||
table.api-reference-table tbody tr td a span,
|
||||
table.api-reference-table tbody tr td a .std,
|
||||
table.api-reference-table tbody tr td a .std-doc,
|
||||
table.api-reference-table tbody tr td a .xref,
|
||||
table.api-reference-table tbody tr td a .pre,
|
||||
table.api-reference-table tbody tr td:not(:first-child) a code,
|
||||
table.api-reference-table tbody tr td:not(:first-child) a code * {
|
||||
color: inherit !important;
|
||||
@@ -946,6 +1188,43 @@ html[data-theme="dark"] table.api-reference-table tbody tr td:not(:first-child)
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
|
||||
/* Functions-table signature cell: the row is rendered as
|
||||
* `<a><code>cv::name</code></a> <code>(<a>Type</a> arg, …)</code>`
|
||||
* The unanchored `<code>` wrapping the parameter list (and any `<code>`
|
||||
* around inline tokens) picks up the default code-chip background +
|
||||
* border via the global `code` rule, which renders as a "grey box"
|
||||
* around the clickables. Strip the chip styling AND the 500 weight
|
||||
* that makes the link text read as bold — clickables here should be
|
||||
* plain blue text, not boxed-and-bold. Applies to both the cell
|
||||
* `<code>` and any inner `<span class="pre">` Sphinx wraps long
|
||||
* tokens in. */
|
||||
table.api-function-table tbody tr td code,
|
||||
table.api-function-table tbody tr td code *,
|
||||
table.api-function-table tbody tr td a,
|
||||
table.api-function-table tbody tr td a code,
|
||||
table.api-function-table tbody tr td a code * {
|
||||
background: transparent !important;
|
||||
background-color: transparent !important;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
padding: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
font-weight: normal !important;
|
||||
font-size: inherit !important;
|
||||
}
|
||||
html[data-theme="dark"] table.api-function-table tbody tr td code,
|
||||
html[data-theme="dark"] table.api-function-table tbody tr td code *,
|
||||
html[data-theme="dark"] table.api-function-table tbody tr td a code,
|
||||
html[data-theme="dark"] table.api-function-table tbody tr td a code * {
|
||||
background: transparent !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
/* Functions summary cards: the signature is split one parameter per line, each
|
||||
line its own <code> span joined by <br>, with a padded type column built from
|
||||
spaces (à la `_signature_lines`). Inline <code> collapses runs of spaces,
|
||||
which would wreck that alignment — preserve them and keep wrapping for long
|
||||
lists, so the card signature reads like the detail-block declaration. */
|
||||
table.api-function-table tbody tr td:not(:first-child) a code,
|
||||
table.api-function-table tbody tr td:not(:first-child) code {
|
||||
white-space: pre-wrap;
|
||||
@@ -1102,12 +1381,15 @@ table.api-typedef-table tbody tr td:nth-child(2) {
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2),
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2) a,
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2) a:link,
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2) a:visited,
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2) a:hover {
|
||||
color: #ffffff !important;
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2) a:hover,
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2) a *,
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2) a:link *,
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2) a:visited *,
|
||||
html[data-theme="dark"] table.api-typedef-table tbody tr td:nth-child(2) a:hover * {
|
||||
color: #0969da !important;
|
||||
}
|
||||
|
||||
table.api-typedef-table tbody tr td:nth-child(2) a,
|
||||
@@ -1175,8 +1457,8 @@ a.opencv-class-more:hover {
|
||||
color: #0550ae;
|
||||
text-decoration: underline;
|
||||
}
|
||||
html[data-theme="dark"] a.opencv-class-more { color: #539bf5; }
|
||||
html[data-theme="dark"] a.opencv-class-more:hover { color: #6cb6ff; }
|
||||
html[data-theme="dark"] a.opencv-class-more { color: #0969da; }
|
||||
html[data-theme="dark"] a.opencv-class-more:hover { color: #0969da; }
|
||||
|
||||
.opencv-class-files { margin-top: 1.75rem; }
|
||||
.opencv-class-files > h2 { display: none; }
|
||||
@@ -1412,3 +1694,90 @@ a.SRScope {
|
||||
color: var(--pst-color-text-muted) !important;
|
||||
}
|
||||
.SRPage .SRStatus { color: var(--pst-color-text-muted); padding: 8px 16px; }
|
||||
|
||||
/* ============================================================
|
||||
* GLOBAL DARK-MODE CLICKABLE-BLUE OVERRIDE
|
||||
* ------------------------------------------------------------
|
||||
* One rule to keep every clickable a consistent blue in dark
|
||||
* mode. Light mode already paints links `#0969da`; pst-sphinx
|
||||
* repaints them lighter (or grey, or visited-purple) in dark
|
||||
* mode through dozens of class-specific rules. Rather than
|
||||
* chase each one, this final block forces every `<a>` (and
|
||||
* every descendant of `<a>`) inside `html[data-theme="dark"]`
|
||||
* back to the same `#0969da` link blue used in light mode —
|
||||
* body content, sidebar, TOC, tables, code chips, code-block
|
||||
* tokens, See-Also lines, breadcrumbs, footers. Visited /
|
||||
* hover / active / focused all collapse to the same hex per
|
||||
* the "no hover-blue, everything at rest" rule.
|
||||
*
|
||||
* Specificity: `html[data-theme="dark"] a` is (0,0,1,2); the
|
||||
* `* { color: unset }` rule earlier in the file is (0,0,1,2)
|
||||
* too but ours runs LATER and uses `!important`, so it wins.
|
||||
* ============================================================ */
|
||||
html[data-theme="dark"] a,
|
||||
html[data-theme="dark"] a:link,
|
||||
html[data-theme="dark"] a:visited,
|
||||
html[data-theme="dark"] a:focus,
|
||||
html[data-theme="dark"] a *,
|
||||
html[data-theme="dark"] a:link *,
|
||||
html[data-theme="dark"] a:visited *,
|
||||
html[data-theme="dark"] a:focus * {
|
||||
color: #0969da !important;
|
||||
}
|
||||
html[data-theme="dark"] a:hover,
|
||||
html[data-theme="dark"] a:hover *,
|
||||
html[data-theme="dark"] a:active,
|
||||
html[data-theme="dark"] a:active * {
|
||||
color: #0969da !important;
|
||||
}
|
||||
|
||||
/* Pygments-tokens-inside-link override.
|
||||
* The dark-mode Pygments rule `html[data-theme="dark"] .highlight .n
|
||||
* { color:#cdd9e5 !important }` (3-class specificity) was beating the
|
||||
* global `html[data-theme="dark"] a *` rule above (1-class) when a
|
||||
* Pygments identifier span (`.n`, `.nc`, `.nf`, `.na`, `.nb`, `.nv`,
|
||||
* `.nn`, `.pre`) sat inside an `<a>` — so enum-synopsis entries like
|
||||
* `cv::NORM_INF` rendered the same grey as plain identifiers. Adding
|
||||
* `.highlight` to the selector raises specificity to (0,0,3,2),
|
||||
* enough to win on every token class Pygments uses for names. */
|
||||
html[data-theme="dark"] .highlight a,
|
||||
html[data-theme="dark"] .highlight a *,
|
||||
html[data-theme="dark"] .highlight a .n,
|
||||
html[data-theme="dark"] .highlight a .na,
|
||||
html[data-theme="dark"] .highlight a .nb,
|
||||
html[data-theme="dark"] .highlight a .nc,
|
||||
html[data-theme="dark"] .highlight a .nf,
|
||||
html[data-theme="dark"] .highlight a .nv,
|
||||
html[data-theme="dark"] .highlight a .nn,
|
||||
html[data-theme="dark"] .highlight a .pre,
|
||||
html[data-theme="dark"] .highlight a .o,
|
||||
html[data-theme="dark"] .highlight a .p {
|
||||
color: #0969da !important;
|
||||
}
|
||||
html[data-theme="dark"] .highlight a:hover,
|
||||
html[data-theme="dark"] .highlight a:hover *,
|
||||
html[data-theme="dark"] .highlight a:hover .n,
|
||||
html[data-theme="dark"] .highlight a:hover .nc,
|
||||
html[data-theme="dark"] .highlight a:hover .nf {
|
||||
color: #0969da !important;
|
||||
}
|
||||
|
||||
/* Parameter-name box in member-detail "Parameters" lists (light + dark). The
|
||||
`section[…-documentation]` selector out-specifies the blanket transparent
|
||||
`<code>` rule so the box survives in dark mode. */
|
||||
code.opencv-param-name,
|
||||
section[id$="-documentation"] code.opencv-param-name {
|
||||
background-color: #eff1f3 !important;
|
||||
border: 1px solid #d0d7de !important;
|
||||
border-radius: 4px !important;
|
||||
padding: 0.1em 0.4em !important;
|
||||
font-size: 0.85em !important;
|
||||
color: #24292f !important;
|
||||
white-space: nowrap;
|
||||
}
|
||||
html[data-theme="dark"] code.opencv-param-name,
|
||||
html[data-theme="dark"] section[id$="-documentation"] code.opencv-param-name {
|
||||
background-color: #2d333b !important;
|
||||
border: 1px solid #444c56 !important;
|
||||
color: #adbac7 !important;
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" width="164" height="153" viewBox="0 0 164 153" fill="none"><path d="M144.618 79.1998C156.154 85.9868 163.907 98.5221 163.932 112.877C163.969 134.484 146.484 152.031 124.877 152.068C103.269 152.106 85.7225 134.62 85.6847 113.013C85.6597 98.6587 93.3683 86.0964 104.881 79.2691L116.123 98.2666C116.405 98.7431 116.245 99.3554 115.787 99.6669C111.536 102.561 108.748 107.443 108.758 112.973C108.773 121.837 115.972 129.011 124.836 128.995C133.701 128.98 140.874 121.781 140.859 112.917C140.849 107.387 138.044 102.515 133.783 99.6355C133.324 99.3256 133.162 98.7139 133.442 98.2364L144.618 79.1998Z" fill="#128DFF"></path><path d="M58.2668 78.9714C52.6177 75.8052 46.1027 74 39.1662 74C17.5588 74 0.0426025 91.5162 0.0426025 113.124C0.0426025 134.731 17.5588 152.247 39.1662 152.247C60.8798 152.247 78.8229 133.813 78.2771 112.12H56.2529C55.6746 112.12 55.2192 112.609 55.2155 113.188C55.1596 121.833 47.9463 129.174 39.1662 129.174C30.3016 129.174 23.1155 121.988 23.1155 113.124C23.1155 104.259 30.3016 97.0729 39.1662 97.0729C41.4876 97.0729 43.694 97.5657 45.6863 98.4525C46.1732 98.6692 46.7542 98.505 47.0247 98.0459L58.2668 78.9714Z" fill="#8BDA67"></path><path d="M61.431 72.834C49.9062 66.0268 42.1757 53.4779 42.1757 39.1235C42.1757 17.5162 59.6919 0 81.2992 0C102.907 0 120.423 17.5162 120.423 39.1235C120.423 53.4779 112.692 66.0268 101.167 72.834L89.9591 53.8169C89.678 53.3399 89.8386 52.7279 90.2968 52.4171C94.5531 49.5307 97.3499 44.6537 97.3499 39.1235C97.3499 30.259 90.1638 23.0729 81.2992 23.0729C72.4347 23.0729 65.2485 30.259 65.2485 39.1235C65.2485 44.6537 68.0453 49.5307 72.3016 52.4171C72.7599 52.7279 72.9204 53.3399 72.6393 53.8169L61.431 72.834Z" fill="#FF2A44"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,135 @@
|
||||
/* Single source of truth for the documentation version dropdown.
|
||||
*
|
||||
* Consumed by BOTH:
|
||||
* - the legacy Doxygen pages (2.x .. 4.x, 5.0.0-pre): the block below
|
||||
* renders this list into the `#projectnumber` span next to the logo
|
||||
* (needs jQuery, which those pages already load); and
|
||||
* - the new Sphinx (PyData) 5.0 docs: the navbar switcher template reads
|
||||
* `window.OPENCV_DOC_VERSIONS` directly and builds its own <select>.
|
||||
*
|
||||
* To publish a new release, add ONE entry here ['<label>', '<site-path>']
|
||||
* and redeploy this file to the bucket root — the option then appears in
|
||||
* the dropdown on every version's pages at once. Do not maintain a second
|
||||
* list anywhere. */
|
||||
window.OPENCV_DOC_VERSIONS = [
|
||||
['4.13.0', '/4.13.0'],
|
||||
['4.12.0', '/4.12.0'],
|
||||
['4.11.0', '/4.11.0'],
|
||||
['5.0', '/5.0'],
|
||||
['5.0.0alpha', '/5.0.0-alpha'],
|
||||
['4.10.0', '/4.10.0'],
|
||||
['4.9.0', '/4.9.0'],
|
||||
['4.8.0', '/4.8.0'],
|
||||
['4.7.0', '/4.7.0'],
|
||||
['4.6.0', '/4.6.0'],
|
||||
['4.5.5', '/4.5.5'],
|
||||
['4.5.4', '/4.5.4'],
|
||||
['4.5.3', '/4.5.3'],
|
||||
['4.5.2', '/4.5.2'],
|
||||
['4.5.1', '/4.5.1'],
|
||||
['4.5.0', '/4.5.0'],
|
||||
['4.4.0', '/4.4.0'],
|
||||
['4.3.0', '/4.3.0'],
|
||||
['4.2.0', '/4.2.0'],
|
||||
['4.1.2', '/4.1.2'],
|
||||
['4.1.1', '/4.1.1'],
|
||||
['4.1.0', '/4.1.0'],
|
||||
['4.0.1', '/4.0.1'],
|
||||
['4.0.0', '/4.0.0'],
|
||||
// no more 3.4 releases: ['3.4.21-pre', '/3.4'],
|
||||
['3.4.20-dev', '/3.4'],
|
||||
['3.4.20', '/3.4.20'],
|
||||
['3.4.19', '/3.4.19'],
|
||||
['3.4.18', '/3.4.18'],
|
||||
['3.4.17', '/3.4.17'],
|
||||
['3.4.16', '/3.4.16'],
|
||||
['3.4.15', '/3.4.15'],
|
||||
['3.4.14', '/3.4.14'],
|
||||
['3.4.13', '/3.4.13'],
|
||||
['3.4.12', '/3.4.12'],
|
||||
['3.4.11', '/3.4.11'],
|
||||
['3.4.10', '/3.4.10'],
|
||||
['3.4.9', '/3.4.9'],
|
||||
['3.4.8', '/3.4.8'],
|
||||
['3.4.7', '/3.4.7'],
|
||||
['3.4.6', '/3.4.6'],
|
||||
['3.4.5', '/3.4.5'],
|
||||
['3.4.4', '/3.4.4'],
|
||||
['3.4.3', '/3.4.3'],
|
||||
['3.4.2', '/3.4.2'],
|
||||
['3.4.1', '/3.4.1'],
|
||||
['3.4.0', '/3.4.0'],
|
||||
['3.3.1', '/3.3.1'],
|
||||
['3.3.0', '/3.3.0'],
|
||||
['3.2.0', '/3.2.0'],
|
||||
['3.1.0', '/3.1.0'],
|
||||
['3.0.0', '/3.0.0'],
|
||||
];
|
||||
|
||||
// Present the dropdown newest-first regardless of the order entries were added
|
||||
// above, so publishing a release stays a one-line append (no manual re-sorting).
|
||||
// Sort by numeric major.minor.patch descending; suffixes like "-dev"/"-pre"/
|
||||
// "alpha" carry no digits and are ignored by the key, so same-base variants
|
||||
// (e.g. "5.0" / "5.0.0-pre" / "5.0.0alpha") tie — Array.sort is stable, so they
|
||||
// keep the order written above.
|
||||
window.OPENCV_DOC_VERSIONS.sort(function (a, b) {
|
||||
var ka = (a[0].match(/\d+/g) || []).map(Number);
|
||||
var kb = (b[0].match(/\d+/g) || []).map(Number);
|
||||
for (var i = 0; i < Math.max(ka.length, kb.length); i++) {
|
||||
var d = (kb[i] || 0) - (ka[i] || 0);
|
||||
if (d) return d;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
function renderDoxygenVersionDropdown() {
|
||||
// Doxygen-only rendering. The Sphinx pages have no `#projectnumber` and
|
||||
// no jQuery, so bail early there — they read OPENCV_DOC_VERSIONS above
|
||||
// and build their own dropdown in the navbar template.
|
||||
if (!document.getElementById("projectnumber") || typeof window.jQuery === "undefined")
|
||||
return;
|
||||
var versions = window.OPENCV_DOC_VERSIONS;
|
||||
var h = '<select>';
|
||||
var current_ver = $("#projectnumber")[0].innerText || versions[0][0];
|
||||
current_ver = current_ver.trim();
|
||||
for (i = 0; i < versions.length; i++) {
|
||||
selected = ''
|
||||
if(current_ver === versions[i][0])
|
||||
selected = ' selected="selected"';
|
||||
h += '<option value="' + versions[i][0] + '"' + selected + '>' + versions[i][0] + '</option>';
|
||||
}
|
||||
h += '</select>';
|
||||
$("#projectnumber")[0].innerHTML = h;
|
||||
$("#projectnumber select")[0].addEventListener('change', function() {
|
||||
var v = $(this).children('option:selected').attr('value');
|
||||
var path = undefined;
|
||||
for (i = 0; i < versions.length; i++) {
|
||||
if(v === versions[i][0]) {
|
||||
path = versions[i][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!path) return;
|
||||
// Go straight to the chosen version's index via its site-absolute path,
|
||||
// so switching works from ANY page of ANY version — no fragile attempt to
|
||||
// substitute the current version inside the current URL (which fails on
|
||||
// pages whose path isn't "/<version>/...", e.g. the 5.0 C++ API tree).
|
||||
// The S3 *website* endpoint serves "/4.13.0/" as index.html, but the plain
|
||||
// REST endpoint does not, so append index.html explicitly.
|
||||
if (!/\.html?($|[?#])/.test(path))
|
||||
path = path.replace(/\/+$/, '') + '/index.html';
|
||||
window.location.href = path; // navigate
|
||||
});
|
||||
return current_ver;
|
||||
}
|
||||
|
||||
// Run as soon as possible. On a normal page load this fires on DOMContentLoaded;
|
||||
// but on the already-deployed legacy pages this file is pulled in dynamically
|
||||
// (a loader appended to dynsections.js) and may arrive AFTER DOMContentLoaded
|
||||
// has fired — in which case render immediately instead of waiting for an event
|
||||
// that will never come again.
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", renderDoxygenVersionDropdown);
|
||||
} else {
|
||||
renderDoxygenVersionDropdown();
|
||||
}
|
||||
Reference in New Issue
Block a user