From 5da1524f06029be01d861a61f0b4b554e7cbb3c1 Mon Sep 17 00:00:00 2001 From: Willem Date: Thu, 30 Jan 2025 03:11:14 +0100 Subject: [PATCH] Backported jdk dark theme css vars to jdk7 html layout version --- .../x4o/maisdoc/flake/MaisDocContentCss.java | 137 +++++++++++++++++- .../maisdoc/flake/MaisDocContentWriter.java | 5 +- .../x4o/maisdoc/flake/MaisDocGenerator.java | 51 ++++++- .../org/x4o/maisdoc/theme/base/api-color.css | 104 ++++++------- .../org/x4o/maisdoc/theme/base/api-font.css | 4 +- .../org/x4o/maisdoc/theme/base/api-inset.css | 11 +- .../org/x4o/maisdoc/theme/base/api-layout.css | 6 - .../org/x4o/maisdoc/theme/base/api-theme.css | 75 ++++++++++ .../org/x4o/maisdoc/theme/base/api-theme.js | 25 ++++ .../org/x4o/maisdoc/theme/jdk6/stylesheet.css | 8 + .../org/x4o/maisdoc/theme/jdk7/stylesheet.css | 84 ++++++++--- .../java/org/x4o/sax3/SAX3WriterHtml.java | 9 ++ .../sax3/io/AbstractContentWriterLexical.java | 4 +- 13 files changed, 429 insertions(+), 94 deletions(-) create mode 100644 nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-theme.css create mode 100644 nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-theme.js diff --git a/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocContentCss.java b/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocContentCss.java index ec2807b..e3abe5e 100644 --- a/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocContentCss.java +++ b/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocContentCss.java @@ -71,5 +71,140 @@ public enum MaisDocContentCss { // frame names maybe can be used to create frame-less html5 JS version frameNavOverview, frameNavDetail, - frameContent + frameContent, + ; + +// // Below is the updated javadoc css classes, for now we keep the old sun gold. +// // +// // IDs; +// // - button#navbar-toggle-button +// // - #search-input +// // - #page-search-input +// // - #reset-button +// // - div#result-container +// // - span#page-search-link +// // - button#page-search-copy +// // - div#navbar-top +// // - div#navbar-sub-list +// // +// // CSS +// MEMBER_SIGNATURE, +// SUMMARY_TABLE, +// ABOUT_LANGUAGE, +// LEGAL_COPY, +// FLEX_BOX, +// FLEX_HEADER, +// FLEX_CONTENT, +// TOP_NAV, +// SUB_NAV_LIST_SMALL, +// SUB_NAV, +// SUB_NAV_LIST, +// NAV_LIST, +// NAV_LIST_SEARCH, +// NAV_BAR_CELL1_REV, +// SKIP_NAV, +// TITLE, +// SUB_TITLE, +// CONTENTS_LIST, +// CLASS_DECLARATION_PAGE, +// DETAILS, +// CLASS_USE_PAGE, +// MODULE_DECLARATION_PAGE, +// BLOCK_LIST, +// SUMMARY, +// INHERITED_LIST, +// NOTES, +// NAME_VALUE, +// CIRCLE, +// HORIZONTAL, +// INHERITANCE, +// DETAILS_LIST, +// MEMBER_LIST, +// SUMMARY_LIST, +// REF_LIST, +// TAG_LIST, +// TAG_LIST_LONG, +// PREVIEW_FEATURE_LIST, +// DETAILS_TABLE, +// CAPTION, +// TABLE_TABS, +// ACTIVE_TABLE_TAB, +// TABLE_TAB, +// TWO_COLUMN_SEARCH_RESULTS, +// CHECKBOXES, +// TWO_COLUMN_SUMMARY, +// THREE_COLUMN_SUMMARY, +// THREE_COLUMN_RELEASE_SUMMARY, +// FOUR_COLUMN_SUMMARY, +// COL_LAST, +// COL_FIRST, +// COL_SECOND, +// COL_CONSTRUCTOR_NAME, +// COL_SUMMARY_ITEM_NAME, +// TABLE_HEADER, +// EVEN_ROW_COLOR, +// ODD_ROW_COLOR, +// BLOCK, +// MODULE_SIGNATURE, +// PACKAGE_SIGNATURE, +// TYPE_SIGNATURE, +// TYPE_PARAMETER_LONG, +// PARAMETERS, +// EXCEPTIONS, +// TYPE_PARAMETERS, +// SOURCE_LINE_NO, +// DEPRECATED_LABEL, +// DESCRIPTION_FROM_TYPE_LABEL, +// IMPLEMENTATION_LABEL, +// MEMBER_NAME_LINK, +// MODULE_LABEL_IN_PACKAGE, +// MODULE_LABEL_IN_TYPE, +// PACKAGE_LABEL_IN_TYPE, +// PACKAGE_HIERARCHY_LABEL, +// TYPE_NAME_LABEL, +// TYPE_NAME_LINK, +// SEARCH_TAG_LINK, +// PREVIEW_LABEL, +// DEPRECATION_COMMENT, +// HELP_FOOTNOTE, +// PREVIEW_COMMENT, +// DEPRECATION_BLOCK, +// PREVIEW_BLOCK, +// INVALID_TAG, +// UI_STATE_ACTIVE, +// UI_AUTOCOMPLETE_CATEGORY, +// UI_AUTOCOMPLETE, +// UI_STATIC_LINK, +// RESULT_ITEM, +// RESULT_HIGHLIGHT, +// SEARCH_TAG_DESC_RESULT, +// SEARCH_TAG_HOLDER_RESULT, +// SEARCH_TAB_RESULT, +// PAGE_SEARCH_DETAILS, +// SEARCH_RESULT_LINK, +// PAGE_SEARCH_INFO, +// PAGE_SEARCH_HEADER, +// MODULE_GRAPH, +// SEALED_GRAPH, +// CLASS_DESCRIPTION, +// CLASS_USES, +// DETAIL, +// SERIALIZED_CLASS_DETAILS, +// VERTICAL_SEPARATOR, +// HELP_SECTION_LIST, +// HELP_SUBTOC, +// HELP_NOTE, +// ANCHOR_LINK, +// COPY, +// SNIPPET_COPY, +// SNIPPET_CONTAINER, +// BORDERLESS, +// PLAIN, +// STRIPED, +// NAV_BAR_TOGGLE_ICON, +// EXPANDED, +// SNIPPET, +// ITALIC, +// BOLD, +// HIGHLIGHTED, } diff --git a/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocContentWriter.java b/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocContentWriter.java index 63e04ae..eee7570 100644 --- a/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocContentWriter.java +++ b/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocContentWriter.java @@ -65,6 +65,7 @@ public class MaisDocContentWriter extends SAX3WriterHtml { printHeadMeta("keywords", keyword); } printHeadLinkCss(pathPrefix+"resources/stylesheet.css"); + printScriptSrc(pathPrefix+"resources/api-theme.js"); printTagEnd(Tag.head); // ======= Write body @@ -73,7 +74,9 @@ public class MaisDocContentWriter extends SAX3WriterHtml { StringBuilder script = new StringBuilder(); script.append("\n"); script.append("\tif (location.href.indexOf('is-external=true') == -1) {\n"); - script.append("\t\tparent.document.title=\"");script.append(title);script.append("\";\n"); + script.append("\t\ttry {\n"); + script.append("\t\t\tparent.document.title=\"");script.append(title);script.append("\";\n"); + script.append("\t\t} catch (e) {}\n"); script.append("\t}\n"); printScriptInline(script.toString()); printScriptNoDiv(); diff --git a/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocGenerator.java b/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocGenerator.java index 564f3f3..77ee077 100644 --- a/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocGenerator.java +++ b/nx01-x4o-maisdoc/src/main/java/org/x4o/maisdoc/flake/MaisDocGenerator.java @@ -553,6 +553,8 @@ public class MaisDocGenerator implements MaisDocContentPrinter { private void writeStyleSheet() throws IOException { try { + copyResourceToFile("org/x4o/maisdoc/theme/base/api-theme.js",basePath,"resources","api-theme.js"); + if (doc.getMetaStyleSheet()!=null) { copyStreamToFile(new FileInputStream(doc.getMetaStyleSheet()),basePath,"resources","stylesheet.css"); return; @@ -562,6 +564,7 @@ public class MaisDocGenerator implements MaisDocContentPrinter { thema = "jdk7"; } List cssResources = new ArrayList(10); + cssResources.add("org/x4o/maisdoc/theme/base/api-theme.css"); cssResources.add("org/x4o/maisdoc/theme/base/api-html.css"); cssResources.add("org/x4o/maisdoc/theme/base/api-layout.css"); cssResources.add("org/x4o/maisdoc/theme/base/api-inset.css"); @@ -582,14 +585,6 @@ public class MaisDocGenerator implements MaisDocContentPrinter { copyResourceToFile("org/x4o/maisdoc/theme/jdk7/titlebar.png",basePath,"resources","titlebar.png"); return; } - if ("jdk7-todo".equals(thema)) { - cssResources.add("org/x4o/maisdoc/theme/jdk7-todo/stylesheet.css"); - writeStyleSheetResources(cssResources); - copyResourceToFile("org/x4o/maisdoc/theme/jdk7/background.png",basePath,"resources","background.png"); - copyResourceToFile("org/x4o/maisdoc/theme/jdk7/tab.png",basePath,"resources","tab.png"); - copyResourceToFile("org/x4o/maisdoc/theme/jdk7/titlebar_end.png",basePath,"resources","titlebar_end.png"); - copyResourceToFile("org/x4o/maisdoc/theme/jdk7/titlebar.png",basePath,"resources","titlebar.png"); - } } catch (SecurityException e) { throw new IOException(e.getMessage()); } catch (InterruptedException e) { @@ -620,6 +615,7 @@ public class MaisDocGenerator implements MaisDocContentPrinter { writer.printHeadTitle(title); writer.printHeadMetaDate(); writer.printHeadLinkCss(resourcePrefix+"resources/stylesheet.css"); + writer.printScriptSrc(resourcePrefix+"resources/api-theme.js"); writer.printTagEnd(Tag.head); } @@ -1027,6 +1023,45 @@ public class MaisDocGenerator implements MaisDocContentPrinter { } writer.printTagEnd(Tag.ul); + if (isTop) { + writer.printTagStart(Tag.ul,MaisDocContentCss.navList); + writer.printTagStart(Tag.li); + writer.printTagStart(Tag.div); + atts = new AttributesImpl(); + atts.addAttribute("", "href", "", "", "#"); + atts.addAttribute("", "id", "", "", "theme_switcher"); + writer.printTagStart(Tag.a, atts); + writer.printCharacters("⍝"); + writer.printTagEnd(Tag.a); + writer.printTagEnd(Tag.div); + writer.printTagEnd(Tag.li); + writer.printTagEnd(Tag.ul); + + StringBuilder buf = new StringBuilder(); + buf.append("\n"); + buf.append("const switchTheme = document.getElementById('theme_switcher');\n"); + buf.append("switchTheme.addEventListener('click', (e)=> {\n"); + buf.append("\te.preventDefault();\n"); + buf.append("\tif (\"dark\"==readCookie(\"theme\")) {\n"); + buf.append("\t\tcreateCookie(\"theme\", \"light\", 365);\n"); + buf.append("\t} else {\n"); + buf.append("\t\tcreateCookie(\"theme\", \"dark\", 365);\n"); + buf.append("\t}\n"); + if (pathPrefix.isEmpty()) { + buf.append("\ttop.location.href = 'index.html';\n"); + } else { + buf.append("\ttop.location.href = '"+pathPrefix+"index.html';\n"); + } + buf.append("});\n"); + buf.append("if (\"dark\"==readCookie(\"theme\")) {\n"); + buf.append("switchTheme.innerHTML = '⍝ Light';\n"); + buf.append("} else {\n"); + buf.append("switchTheme.innerHTML = '⍝ Dark';\n"); + buf.append("}\n"); + writer.printScriptInline(buf.toString()); + } + + writer.docNavBarAbout(doc.getDocAbout()); writer.printTagEnd(Tag.div); // end barCssDiv diff --git a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-color.css b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-color.css index fe90e10..f126120 100644 --- a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-color.css +++ b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-color.css @@ -21,126 +21,126 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ body { - background-color:#ffffff; - color:#353833; + background-color: var(--body-background-color); + color: var(--body-text-color); } a:link, a:visited { - color:#4c6b87; + color: var(--link-color); } a:hover, a:focus { - color:#bb7a2a; + color: var(--link-color-active); } a:active { - color:#4c6b87; + color: var(--link-color); } a[name] { - color:#353833; + color:var(--block-text-color); } a[name]:hover { - color:#353833; + color:var(--block-text-color); } .bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; + color: var(--navbar-text-color); } .bar a:hover, .bar a:focus { - color:#bb7a2a; + color:var(--selected-background-color); } .tab { - background-color:#0066FF; - color:#ffffff; + background-color:var(--navbar-background-color); + color: var(--navbar-text-color); } -.bar { - color:#FFFFFF; -} -.topNav { - color:#FFFFFF; -} -.bottomNav { - color:#FFFFFF; +.bar, .topNav, .bottomNav { + color: var(--navbar-text-color); + background-color: var(--navbar-background-color); } .subNav { - background-color:#dee3e9; - border-bottom:1px solid #9eadc0; + background-color:var(--subnav-background-color); + border-bottom:1px solid var(--border-color); } .topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; + color: var(--navbar-text-color); } .topNav a:hover, .bottomNav a:hover { - color:#bb7a2a; + color:var(--selected-background-color); } .navBarCell1Rev { - color:#FFFFFF; - border:1px solid #c9aa44; + color: var(--navbar-text-color); + background-color: var(--selected-background-color); + border:1px solid var(--selected-background-color); } .title { - color:#2c4557; + color:var(--title-color); } div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; + background-color:var(--detail-background-color); + border-top:1px solid var(--border-color); + border-bottom:1px solid var(--border-color); } ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; + background-color:var(--detail-background-color); + border-top:1px solid var(--border-color); + border-bottom:1px solid var(--border-color); } .contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - color:#4E4E4E; + color:var(--block-text-color); } ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - border:1px solid #9eadc0; - background-color:#f9f9f9; + border:1px solid var(--border-color); + background-color:var(--section-background-color); } ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - background-color:#ffffff; - border:1px solid #9eadc0; + background-color:var(--detail-background-color); + border:1px solid var(--border-color); border-top:none; } ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { border:none; - border-bottom:1px solid #9eadc0; + border-bottom:1px solid var(--border-color); } ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { border-bottom:none; } .contentContainer table, .classUseContainer table, .constantValuesContainer table { - border-bottom:1px solid #9eadc0; + border-bottom:1px solid var(--border-color); } .contentContainer .description table, .contentContainer .details table { border-bottom:none; } .overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption { - color:#FFFFFF; + color:var(--body-background-color); +} +.overviewSummary caption span,.packageSummary caption span,.contentContainer ul.blockList li.blockList caption span,.summary caption span,.classUseContainer caption span,.constantValuesContainer caption span { + background-color: var(--selected-background-color); } caption a:link, caption a:hover, caption a:active, caption a:visited { - color:#FFFFFF; + color:var(--body-background-color); + background-color: var(--selected-background-color); } .tableSubHeadingColor { - background-color: #EEEEFF; + background-color: var(--detail-background-color); } .altColor { - background-color:#eeeeef; + background-color:var(--odd-row-color); } .rowColor { - background-color:#ffffff; + background-color:var(--even-row-color); } th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { - background:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; + background:var(--subnav-background-color); + border-top:1px solid var(--border-color); + border-bottom:1px solid var(--border-color); } td.colFirst, th.colFirst { - border-left:1px solid #9eadc0; + border-left:1px solid var(--border-color); } td.colLast, th.colLast { - border-right:1px solid #9eadc0; + border-right:1px solid var(--border-color); } td.colOne, th.colOne { - border-right:1px solid #9eadc0; - border-left:1px solid #9eadc0; + border-right:1px solid var(--border-color); + border-left:1px solid var(--border-color); } .sourceLineNo { - color:green; + color: var(--snippet-highlight-color); } diff --git a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-font.css b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-font.css index f2ac51c..586e8b8 100644 --- a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-font.css +++ b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-font.css @@ -21,8 +21,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ body { - font-family:Arial, Helvetica, sans-serif; - font-size:76%; + font-family: var(--body-font-family); + font-size: var(--body-font-size); } pre { font-size:1.3em; diff --git a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-inset.css b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-inset.css index 427bd62..8e2db88 100644 --- a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-inset.css +++ b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-inset.css @@ -47,6 +47,9 @@ body { padding:0px; padding-top:10px; } +.subNav { + padding-top: 2px; +} .subNav div { padding:0px 0px 5px 6px; } @@ -168,17 +171,19 @@ table tr td dl, table tr td dl dt, table tr td dl dd { margin:0px; } .overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { - padding-top:8px; + padding-top:6px; + padding-bottom:2px; padding-left:8px; + padding-right:8px; } ul.blockList ul.blockList li.blockList table { margin:0px 0px 12px 0px; } .overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td { - padding:3px 3px 3px 7px; + padding:4px 4px 4px 7px; } th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { - padding:3px 3px 3px 7px; + padding:4px 4px 4px 7px; } table.overviewSummary { padding:0px; diff --git a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-layout.css b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-layout.css index 9575ad2..64a7e85 100644 --- a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-layout.css +++ b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-layout.css @@ -112,7 +112,6 @@ ul.inheritance li { height:18px; } .overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { - width:10px; position:relative; float:left; } @@ -144,8 +143,3 @@ h1.hidden { .block { display:block; } - - - - - diff --git a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-theme.css b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-theme.css new file mode 100644 index 0000000..12a16f5 --- /dev/null +++ b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-theme.css @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2004-2014, Willem Cazander + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +:root { + /* body, block and code fonts */ + --body-font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + --block-font-family: 'DejaVu Serif', Georgia, "Times New Roman", Times, + serif; + --code-font-family: 'DejaVu Sans Mono', monospace; + /* Base font sizes for body and code elements */ + --body-font-size: 14px; + --code-font-size: 14px; + /* Text colors for body and block elements */ + --body-text-color: #353833; + --block-text-color: #474747; + /* Background colors for various structural elements */ + --body-background-color: #ffffff; + --section-background-color: #f8f8f8; + --detail-background-color: #ffffff; + /* Colors for navigation bar and table captions */ + --navbar-background-color: #4D7A97; + --navbar-text-color: #ffffff; + /* Background color for subnavigation and various headers */ + --subnav-background-color: #dee3e9; + /* Background and text colors for selected tabs and navigation items */ + --selected-background-color: #f8981d; + --selected-text-color: #253441; + --selected-link-color: #1f389c; + /* Background colors for generated tables */ + --even-row-color: #ffffff; + --odd-row-color: #eeeeef; + /* Text color for page title */ + --title-color: #2c4557; + /* Text colors for links */ + --link-color: #4A6782; + --link-color-active: #bb7a2a; + /* Snippet colors */ + --snippet-background-color: #ebecee; + --snippet-text-color: var(--block-text-color); + --snippet-highlight-color: #f7c590; + /* Border colors for structural elements and user defined tables */ + --border-color: #ededed; + --table-border-color: #000000; + /* Search input colors */ + --search-input-background-color: #ffffff; + --search-input-text-color: #000000; + --search-input-placeholder-color: #909090; + /* Highlight color for active search tag target */ + --search-tag-highlight-color: #ffff00; + /* Adjustments for icon and active background colors of copy-to-clipboard buttons */ + --copy-icon-brightness: 100%; + --copy-button-background-color-active: rgba(168, 168, 176, 0.3); + /* Colors for invalid tag notifications */ + --invalid-tag-background-color: #ffe6e6; + --invalid-tag-text-color: #000000; +} diff --git a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-theme.js b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-theme.js new file mode 100644 index 0000000..cfbec7b --- /dev/null +++ b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/base/api-theme.js @@ -0,0 +1,25 @@ + +function createCookie(name, value, days) { + expires = ""; + if (days) { + let date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + expires = "; expires=" + date.toGMTString(); + } + document.cookie = name + "=" + value + expires + ";SameSite=strict; path=/"; +} + +function readCookie(name) { + let nameEQ = name + "="; + let ca = document.cookie.split(';'); + for (let i = 0; i < ca.length; i++) { + let c = ca[i]; + while (c.charAt(0) == ' ') c = c.substring(1, c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); + } + return null; +} + +document.addEventListener('DOMContentLoaded', () => { + document.documentElement.setAttribute('data-theme', readCookie("theme")); +}) diff --git a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/jdk6/stylesheet.css b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/jdk6/stylesheet.css index ea8060b..4eebb7b 100644 --- a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/jdk6/stylesheet.css +++ b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/jdk6/stylesheet.css @@ -42,6 +42,11 @@ body { padding-top: 0px; padding-bottom: 0px; } +.bar { + padding-top: 2px; + padding-bottom: 2px; + color:#000; +} .subNav { background-color: #FFF; @@ -93,6 +98,9 @@ li { .overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { background-color: #EEEEFF; + padding-top: 4px; + padding-bottom: 4px; + color:#000; } .overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { diff --git a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/jdk7/stylesheet.css b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/jdk7/stylesheet.css index afb3485..78ef0e7 100644 --- a/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/jdk7/stylesheet.css +++ b/nx01-x4o-maisdoc/src/main/resources/org/x4o/maisdoc/theme/jdk7/stylesheet.css @@ -20,24 +20,70 @@ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -.tab { - background-image:url(titlebar.png); - background-position:left top; - background-repeat:no-repeat; -} -.bar,.topNav,.bottomNav { - background-image:url(background.png); - background-repeat:repeat-x; -} -.navBarCell1Rev { - background-image:url(tab.png); -} -.overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { - background-image:url(titlebar.png); -} -.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { - background-image:url(titlebar_end.png); - background-repeat:no-repeat; - background-position:top right; + +:root { + --body-font-family: Arial, Helvetica, sans-serif; + --body-font-size: 76%; + --link-color: #4c6b87; + --border-color: #9eadc0; + --block-text-color: #4E4E4E; + --detail-background-color: #dee3e9; + --section-background-color: #f9f9f9; + --selected-background-color: #bb7a2a; + --snippet-highlight-color: green; } +html:not([data-theme="dark"]) { + .tab { + background-image:url(titlebar.png); + background-position:left top; + background-repeat:no-repeat; + } + .bar,.topNav,.bottomNav { + background-image:url(background.png); + background-repeat:repeat-x; + } + .navBarCell1Rev { + background-image:url(tab.png); + } + .overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { + background-image:url(titlebar.png); + } + .overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { + background-image:url(titlebar_end.png); + background-repeat:no-repeat; + background-position:top right; + } +} + +html[data-theme="dark"] { + --body-text-color: #e0e0e3; + --block-text-color: #e6e7ef; + --body-background-color: #404040; + --section-background-color: #484848; + --detail-background-color: #404040; + --navbar-background-color: #505076; + --navbar-text-color: #ffffff; + --subnav-background-color: #303030; + --selected-background-color: #f8981d; + --selected-text-color: #253441; + --selected-link-color: #1f389c; + --even-row-color: #484848; + --odd-row-color: #383838; + --title-color: #ffffff; + --link-color: #a0c0f8; + --link-color-active: #ffb863; + --snippet-background-color: #383838; + --snippet-text-color: var(--block-text-color); + --snippet-highlight-color: #f7c590; + --border-color: #383838; + --table-border-color: #000000; + --search-input-background-color: #000000; + --search-input-text-color: #ffffff; + --search-input-placeholder-color: #909090; + --search-tag-highlight-color: #ffff00; + --copy-icon-brightness: 250%; + --copy-button-background-color-active: rgba(168, 168, 176, 0.3); + --invalid-tag-background-color: #ffe6e6; + --invalid-tag-text-color: #000000; +} diff --git a/nx01-x4o-sax3/src/main/java/org/x4o/sax3/SAX3WriterHtml.java b/nx01-x4o-sax3/src/main/java/org/x4o/sax3/SAX3WriterHtml.java index 3628a8f..d507f8a 100644 --- a/nx01-x4o-sax3/src/main/java/org/x4o/sax3/SAX3WriterHtml.java +++ b/nx01-x4o-sax3/src/main/java/org/x4o/sax3/SAX3WriterHtml.java @@ -101,6 +101,15 @@ public class SAX3WriterHtml extends SAX3WriterEnum