diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 1c2c27481..9c565f70b 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -39,31 +39,19 @@ jobs: changelog-fragment: name: "Create changelog fragment" - needs: "labeler" + needs: [labeler] permissions: contents: write pull-requests: write runs-on: ubuntu-latest steps: - - name: "Setup python" - uses: actions/setup-python@v5 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - - - name: "Checkout repo" - uses: actions/checkout@v4 - - - name: "Install dependencies" - run: | - python -m pip install --upgrade pip - pip install -e .[changelog] - - - uses: ansys/actions/doc-changelog@v8 - if: ${{ github.event_name == 'pull_request' }} - with: - token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + - uses: ansys/actions/doc-changelog@v8 + with: + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + use-conventional-commits: true + use-default-towncrier-config: true + bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} code-style: name: Code style diff --git a/doc/changelog.d/644.added.md b/doc/changelog.d/644.added.md new file mode 100644 index 000000000..df7fbd769 --- /dev/null +++ b/doc/changelog.d/644.added.md @@ -0,0 +1 @@ +migrate css to scss \ No newline at end of file diff --git a/package.json b/package.json index fc3d67b81..36b82cfee 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,21 @@ { "name": "ansys_sphinx_theme", "repository": "https://github.com/ansys/ansys-sphinx-theme", - "description": "", - "main": "", "scripts": { - "build": "echo 'No build step needed' " + "build:scss": "sass src/ansys_sphinx_theme/assets/styles/ansys-sphinx-theme.scss src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/styles/ansys-sphinx-theme.css", + "build:postcss": "postcss src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/styles/ansys-sphinx-theme.css -o src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/styles/ansys-sphinx-theme.css", + "build": "npm run build:scss && npm run build:postcss" }, - "dependencies": {}, - "devDependencies": {} + "devDependencies": { + "autoprefixer": "^10.4.21", + "postcss": "^8.5.3", + "postcss-cli": "^11.0.0", + "postcss-import": "^16.1.0", + "postcss-minify": "^1.1.0", + "postcss-nested": "^7.0.2", + "sass": "^1.85.1" + }, + "dependencies": { + "postcss-scss": "^4.0.9" + } } diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 000000000..1f997a992 --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,9 @@ +const config = { + plugins: [ + require("autoprefixer"), + require("postcss-minify"), + require("postcss-nested"), + ], +}; + +module.exports = config; diff --git a/pyproject.toml b/pyproject.toml index 617611927..c9cbe019a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires = [ build-backend = "sphinx_theme_builder" [tool.sphinx-theme-builder] -node-version = "22.14.0" +node-version = "23.9.0" theme-name = "ansys_sphinx_theme" [project] diff --git a/src/ansys_sphinx_theme/__init__.py b/src/ansys_sphinx_theme/__init__.py index 529d17b41..0c84348c7 100644 --- a/src/ansys_sphinx_theme/__init__.py +++ b/src/ansys_sphinx_theme/__init__.py @@ -58,9 +58,9 @@ THIS_PATH = pathlib.Path(__file__).parent.resolve() THEME_PATH = THIS_PATH / "theme" / "ansys_sphinx_theme" STATIC_PATH = THEME_PATH / "static" -STYLE_PATH = STATIC_PATH / "css" +STYLE_PATH = STATIC_PATH / "styles" JS_PATH = STATIC_PATH / "js" -CSS_PATH = STYLE_PATH / "ansys_sphinx_theme.css" +CSS_PATH = STYLE_PATH / "ansys-sphinx-theme.css" TEMPLATES_PATH = THEME_PATH / "_templates" AUTOAPI_TEMPLATES_PATH = TEMPLATES_PATH / "autoapi" LOGOS_PATH = STATIC_PATH / "logos" @@ -1141,8 +1141,6 @@ def setup(app: Sphinx) -> Dict: use_ansys_search = app.config.html_theme_options.get("use_ansys_search", True) if use_ansys_search: update_search_config(app) - - # Verify that the main CSS file exists if not CSS_PATH.exists(): raise FileNotFoundError(f"Unable to locate ansys-sphinx theme at {CSS_PATH.absolute()}") app.add_css_file(str(CSS_PATH.relative_to(STATIC_PATH))) diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/ansys-sphinx-theme-variable.css b/src/ansys_sphinx_theme/assets/styles/ansys-sphinx-theme-variable.scss similarity index 99% rename from src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/ansys-sphinx-theme-variable.css rename to src/ansys_sphinx_theme/assets/styles/ansys-sphinx-theme-variable.scss index 04666b284..33066a3e1 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/ansys-sphinx-theme-variable.css +++ b/src/ansys_sphinx_theme/assets/styles/ansys-sphinx-theme-variable.scss @@ -1,4 +1,4 @@ -/*Contains variables for colors and fonts used in the theme*/ +/* Contains variables for colors and fonts used in the theme */ @import url("https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;0,900;1,400;1,700;1,900&family=Open+Sans:ital,wght@0,400;0,600;1,400;1,600&display=swap"); @font-face { diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/ansys_sphinx_theme.css b/src/ansys_sphinx_theme/assets/styles/ansys-sphinx-theme.scss similarity index 73% rename from src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/ansys_sphinx_theme.css rename to src/ansys_sphinx_theme/assets/styles/ansys-sphinx-theme.scss index 35b38f09c..812080d47 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/ansys_sphinx_theme.css +++ b/src/ansys_sphinx_theme/assets/styles/ansys-sphinx-theme.scss @@ -1,14 +1,13 @@ /* Provided by the Sphinx base theme template at build time */ - -@import "pydata-sphinx-theme-custom.css"; -@import "breadcrumbs.css"; -@import "ast-search.css"; -@import "sphinx-design.css"; -@import "table-custom.css"; -@import "sphinx-gallery.css"; -@import "whatsnew.css"; -@import "nbsphinx.css"; -@import "ansys-sphinx-theme-variable.css"; +@import "ansys-sphinx-theme-variable"; +@import "pydata-sphinx-theme-custom"; +@import "breadcrumbs"; +@import "ast-search"; +@import "sphinx-design"; +@import "table-custom"; +@import "sphinx-gallery"; +@import "whatsnew"; +@import "nbsphinx"; /* * Code cell diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/ast-search.css b/src/ansys_sphinx_theme/assets/styles/ast-search.scss similarity index 61% rename from src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/ast-search.css rename to src/ansys_sphinx_theme/assets/styles/ast-search.scss index fafdd2bdd..0f744cf19 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/ast-search.css +++ b/src/ansys_sphinx_theme/assets/styles/ast-search.scss @@ -1,3 +1,4 @@ +/* Static Search Results Container */ .static-search-results { display: flex; flex-direction: column; @@ -5,27 +6,33 @@ justify-content: flex-start; position: absolute; background-color: var(--ast-search-bar-enable-background); - width: 630px; + width: 39.375rem; /* 630px */ padding: 1em; border: 1px solid var(--ast-search-bar-enable-border); box-shadow: var(--ast-box-shadow-active); overflow: auto; - max-height: 500px; + max-height: 31.25rem; /* 500px */ } +/* Individual Result Item */ .result-item { cursor: pointer; transition: box-shadow 0.3s ease; border-bottom: thin solid var(--ast-search-bar-enable-border); padding-bottom: 0.5em; margin-bottom: 0.5em; -} -.result-item:last-child { - border-bottom: 0; - margin-bottom: 0; + &:last-child { + border-bottom: 0; + margin-bottom: 0; + } + + &.selected { + box-shadow: var(--ast-ring-shadow-focused); + } } +/* Result Title */ .result-title { font-size: 1em; font-weight: var(--ast-font-weight-bold); @@ -33,20 +40,19 @@ color: var(--ast-catagory-header-text); } +/* Result Text */ .result-text { - font-size: 12px; + font-size: 0.75rem; /* 12px */ font-family: "Open Sans", sans-serif; color: var(--ast-search-bar-enable-text); } -.result-item.selected { - box-shadow: var(--ast-ring-shadow-focused); -} - +/* Highlighted Text */ html[data-theme="light"] .highlight { color: var(--ast-highlight-color); } +/* Search Input Styles */ .bd-search input.form-control, .bd-search input.form-control:focus, .bd-search input.form-control:focus-visible, @@ -55,98 +61,108 @@ html[data-theme="light"] .highlight { .form-control { background-color: var(--ast-search-bar-enable-background); color: var(--ast-search-bar-enable-text); - font-size: 14px; + font-size: 0.875rem; /* 14px */ outline-color: var(--ast-search-bar-enable-border); - border: 0px solid var(--ast-search-bar-enable-border); - width: 300px; + border: 0; + width: 18.75rem; /* 300px */ transition: max-width 0.3s ease; max-width: 200%; - height: 40px; + height: 2.5rem; /* 40px */ } +/* Search Button Wrapper */ .search-button__wrapper.show input, .search-button__wrapper.show svg { - font-size: 14px; + font-size: 0.875rem; /* 14px */ } +/* Search Button Keyboard Shortcut */ .bd-search .search-button__kbd-shortcut { background-color: var(--ast-search-bar-enable-background) !important; box-shadow: none !important; - height: 36px; + height: 2.25rem; /* 36px */ display: flex; flex-wrap: wrap; align-content: center; } +/* Index Select Dropdown */ .index-select { color: var(--ast-search-bar-enable-text); background: var(--ast-search-bar-enable-background); - height: 40px; - font-size: 14px; + height: 2.5rem; /* 40px */ + font-size: 0.875rem; /* 14px */ font-family: "Open Sans", sans-serif; - border: 0.5px solid var(--ast-search-bar-enable-border); - border-radius: 4px; + border: 0.03125rem solid var(--ast-search-bar-enable-border); /* 0.5px */ + border-radius: 0.25rem; /* 4px */ box-shadow: none; - padding: 0px 8px; - margin-left: 2px; + padding: 0 0.5rem; /* 0 8px */ + margin-left: 0.125rem; /* 2px */ } + +/* Focus Visible Outline */ :focus-visible { outline: none; } +/* Search Icon */ #search-icon { - font-size: 24px; - width: 24px; - height: 24px; + font-size: 1.5rem; /* 24px */ + width: 1.5rem; /* 24px */ + height: 1.5rem; /* 24px */ color: var(--ast-search-bar-enable-text); } +/* Form Control Focus Styles */ .form-control:focus, .bd-search:focus-within { box-shadow: none; } -/* Button Styling */ +/* Search Button Styling */ .search-button__button { transition: width 0.3s ease; - width: 50px; /* Initial width */ + width: 3.125rem; /* 50px */ } /* Result Container Styling */ .bd-search { - gap: 8px; + gap: 0.5rem; /* 8px */ background-color: var(--ast-search-bar-enable-background); - border: 0px solid var(--ast-search-bar-enable-border); - margin-bottom: 0px; -} + border: 0 solid var(--ast-search-bar-enable-border); + margin-bottom: 0; -.bd-search input.form-control.expanded { - width: 600px; + input.form-control.expanded { + width: 37.5rem; /* 600px */ + } } +/* Search Icon Styling */ .search-icon { cursor: pointer; } +/* Blurred Main Content */ .bd-main.blurred { opacity: 0.5; transition: opacity 0.3s ease; } -@media (max-width: 768px) { +/* Responsive Styles */ +@media (max-width: 48rem) { /* 768px */ .bd-search input.expanded { - width: 100px; + width: 6.25rem; /* 100px */ } .form-control { - width: 50px; + width: 3.125rem; /* 50px */ } .result { - width: 100px; + width: 6.25rem; /* 100px */ } .bd-search .search-button__kbd-shortcut { display: none; } -} +} \ No newline at end of file diff --git a/src/ansys_sphinx_theme/assets/styles/breadcrumbs.scss b/src/ansys_sphinx_theme/assets/styles/breadcrumbs.scss new file mode 100644 index 000000000..3d8190180 --- /dev/null +++ b/src/ansys_sphinx_theme/assets/styles/breadcrumbs.scss @@ -0,0 +1,112 @@ +/* Provided by the Sphinx base theme template at build time, +styles exclusively for the ansys-sphinx-theme classes. */ +/** +* Breadcrumbs +*/ + +ul.bd-breadcrumbs { + li.breadcrumb-item { + padding: 0; + font-size: 0.75rem; // 12px to rem + display: flex; + + &:hover { + text-decoration: underline; + font-size: 0.75rem; // 12px to rem + } + + a { + color: var(--ast-navbar-color); + font-size: 0.75rem; // 12px to rem + + &:hover { + text-decoration: underline; + } + + &:active { + color: var(--ast-color-text); + } + } + + &.active { + color: var(--ast-color-text); + } + } +} + +/** +* Version warning announcement +*/ + +#announcement_msg { + display: flex; + justify-content: center; + position: relative; + width: 100%; + padding: 0.5rem 12.5%; + text-align: center; + + &:after { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + background-color: rgb(223, 95, 114); + opacity: 0.2; + content: ""; + z-index: -1; + } + + &:empty { + display: none; + } + + p { + font-weight: var(--ast-font-weight-bold); + margin: auto; + color: black; + } + + html[data-theme="dark"] & { + &:after { + background-color: lightpink; + opacity: 0.5; + } + } + + a { + color: var(--ast-color-link); + } +} + +.sidebar-cheatsheets { + text-align: left; + + h4 { + font-weight: 600 !important; + font-size: 1rem !important; + font-family: var(--ast-font-family-base); + color: var(--ast-color-text); + } + + a { + display: inline-flex; + border: 0.03125rem solid var(--pst-color-border); // 0.5px to rem + padding: 0.25rem 0.5rem 0.25rem 0.75rem; // 4px 8px 4px 12px to rem + max-width: 80%; + + &:hover { + background-color: var(--pst-color-border); + color: var(--pst-color-text-base); + } + } + + img { + padding: 0; + } +} + +.bd-sidebar-primary { + padding: 0.5rem; +} diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/nbsphinx.css b/src/ansys_sphinx_theme/assets/styles/nbsphinx.scss similarity index 73% rename from src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/nbsphinx.css rename to src/ansys_sphinx_theme/assets/styles/nbsphinx.scss index 685cb1eea..4c21ff657 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/nbsphinx.css +++ b/src/ansys_sphinx_theme/assets/styles/nbsphinx.scss @@ -5,6 +5,8 @@ /* * Do not display the caption paragraph in the body content for 'nbgallery' */ -.toctree-wrapper > p.caption { - display: none; -} + .toctree-wrapper { + > p.caption { + display: none; + } +} \ No newline at end of file diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/pydata-sphinx-theme-custom.css b/src/ansys_sphinx_theme/assets/styles/pydata-sphinx-theme-custom.scss similarity index 100% rename from src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/pydata-sphinx-theme-custom.css rename to src/ansys_sphinx_theme/assets/styles/pydata-sphinx-theme-custom.scss diff --git a/src/ansys_sphinx_theme/assets/styles/sphinx-design.scss b/src/ansys_sphinx_theme/assets/styles/sphinx-design.scss new file mode 100644 index 000000000..646441efd --- /dev/null +++ b/src/ansys_sphinx_theme/assets/styles/sphinx-design.scss @@ -0,0 +1,251 @@ +/** +* Sphinx design button styles +*/ + +$font-size: var(--ast-sphinx-design-font-size); +$font-weight: var(--ast-font-weight-regular); +$font-family: var(--ast-sphinx-design-font-family); +$border-radius: var(--ast-sphinx-design-border-radius); + +.sd-btn, +.sd-btn-secondary { + font-size: $font-size; + font-weight: $font-weight; + font-family: $font-family; + padding: 0.5rem 1rem; // 8px 16px + border-radius: $border-radius; +} + +.sd-btn-secondary { + color: var(--sd-color-secondary-text); + background-color: var(--sd-color-secondary); + border-color: var(--sd-color-secondary); +} + +/** + * Blockquote styles + */ +blockquote { + background-color: var(--pst-color-background); +} + +/* Media queries */ +@mixin media-query($size) { + @media screen and (max-width: $size) { + @content; + } +} + +/** + * Media query for medium-sized screens + */ +@include media-query(768px) { + .sd-card .sd-card-header { + font-size: var(--pst-font-size-h6); + } +} + +/** + * Media query for small-sized screens + */ +@include media-query(576px) { + .sd-card .sd-card-header { + font-size: var(--pst-font-size-h5); + } + .sd-card { + padding: 0.25rem; // 4px + } +} + + /** + * Sphinx-design dropdown styles + */ + +.bd-content { + details.sd-dropdown { + color: var(--ast-dropdown-text-color); + width: fit-content; + min-width: 25rem; // 400px + + &.sd-dropdown:not([open]) > .sd-card-header { + border-radius: $border-radius; + } + + summary.sd-summary-title { + font-family: $font-family; + font-size: $font-size; + background: var(--ast-color-sphinx-design-background) !important; + border: 1px solid var(--ast-dropdown-border-color) !important; + border-radius: $border-radius; + padding: 0.5rem 0.75rem; // 8px 12px + text-align: left; + + &:hover { + background-color: var(--ast-color-hover-card-background) !important; + border: 1px solid var(--ast-dropdown-border-color-hover) !important; + } + } + + summary.sd-card-header + div.sd-summary-content { + background-color: var(--ast-color-sphinx-design-background); + border-left: none !important; + } + + .sd-summary-title:active + div.sd-summary-content:active { + background-color: var(--ast-color-enable-card-background); + border-color: var(--ast-color-enable-border); + } + + .sd-summary-title:hover + div.sd-summary-content:hover { + background-color: var(--ast-color-hover-card-background); + border-color: var(--ast-color-hover-border); + border-left: none; + } + + summary.sd-summary-title:focus + div.sd-summary-content:focus { + background-color: var(--ast-color-sphinx-design-background); + border-radius: $border-radius; + border-color: var(--pst-color-border); + border-left: none; + } + + summary.sd-card-header + div.sd-summary-content { + color: var(--ast-color-sphinx-design-primary); + font-family: $font-family; + font-size: $font-size; + } + } +} + +/** +* Sphinx-design tab styles +*/ + +.bd-content { + .sd-tab-set { + > label { + font-family: var(--ast-sphinx-design-font-family); + padding: 12px 0px; + border-style: none none solid none; + color: var(--ast-color-sphinx-design-primary); + font-size: var(--ast-sphinx-design-font-size); + margin-inline-end: 16px; + transform: none; + margin-bottom: 1px; + } + + > input { + &:checked + label { + background-color: transparent; + border-color: transparent transparent var(--ast-tab-border-color-active) transparent; + border-width: 0px 0px 2px 0px; + border-style: none none solid none; + transform: none; + + &:hover { + background-color: var(--ast-background-tab-hover); + border-color: transparent transparent var(--ast-tab-border-color-hover) transparent; + border-width: 0px 0px 2px 0px; + } + } + + &:not(:checked, :focus-visible) + label { + background-color: transparent; + border-color: transparent transparent var(--ast-tab-border-color) transparent; + border-width: 0px 0px 1px 0px; + text-decoration-line: none; + font-weight: var(--ast-font-weight-regular); + + &:hover { + background-color: var(--ast-background-tab-hover); + border-color: transparent transparent var(--ast-tab-border-color-hover) transparent; + border-width: 0px 0px 2px 0px; + border-style: none none solid none; + text-decoration: none; + } + } + + &:checked + label:hover, + &:not(:checked, :focus-visible) + label:hover { + color: var(--ast-color-sphinx-design-primary); + font-family: var(--ast-sphinx-design-font-family); + } + + + label:focus-visible, + &:not(:checked, :focus-visible) + label:focus-visible { + background-color: var(--ast-background-tab-focus); + border-color: transparent transparent var(--ast-tab-border-color-hover) transparent; + border-width: 0px 0px 2px 0px; + text-decoration-line: none; + } + } + + .sd-tab-content { + border: none; + font-family: var(--ast-sphinx-design-font-family); + font-size: var(--ast-sphinx-design-font-size); + color: var(--ast-color-sphinx-design-primary); + } + } +} + +.bd-content .sd-tab-set .sd-tab-content { + border: none; + font-family: $font-family; + font-size: $font-size; + color: var(--ast-color-sphinx-design-primary); +} + + @include media-query(768px) { + .sd-tab-set > input:not(.focus-visible) + label { + font-size: 0.875rem; // 14px + } + } + + @include media-query(576px) { + .sd-tab-set > input:not(.focus-visible) + label { + font-size: 0.75rem; // 12px + } + } + + /** + * Sphinx-design card styles + */ + + .bd-content .sd-card { + border: none; + border-radius: 0.5rem; // 8px + box-shadow: var(--ast-box-shadow-hover) !important; + background-color: var(--ast-color-sphinx-design-background); + color: var(--ast-color-sphinx-design-primary); + + .sd-card-body, + .sd-card-footer, + .sd-card-title, + .sd-card-header { + font-size: $font-size; + font-family: $font-family; + border: none; + background-color: var(--ast-color-sphinx-design-background); + } + + .sd-card-title, + .sd-card-header { + font-size: 1rem; // 16px + line-height: 1.5rem; // 24px + } + } + +.bd-content .sd-card:hover { + box-shadow: var(--ast-box-shadow-hover) !important; +} + + .sd-hide-link-text:focus { + outline: none; + box-shadow: none; + } + + .bd-content .sd-card .sd-stretched-link:focus-visible:after { + outline: none; + box-shadow: var(--ast-ring-shadow-focused); + } diff --git a/src/ansys_sphinx_theme/assets/styles/sphinx-gallery.scss b/src/ansys_sphinx_theme/assets/styles/sphinx-gallery.scss new file mode 100644 index 000000000..9a25f87c1 --- /dev/null +++ b/src/ansys_sphinx_theme/assets/styles/sphinx-gallery.scss @@ -0,0 +1,66 @@ +/** + * Sphinx gallery output cell + */ + +.highlight { + pre { + font-size: 0.9em; + } +} + +/** + * Sphinx gallery download button text + */ + +a { + > code.download { + font-family: var(--pst-font-family-base); + color: var(--pst-color-link); + text-decoration: none; + font-weight: var(--ast-font-weight-regular); + } + + &.reference.download:before { + color: var(--ast-color-text); + } +} + +div.sphx-glr-download { + a { + background-color: var(--ast-sphinx-gallery-download-background); + color: var(--ast-sphinx-gallery-download-text); + background-image: none; + text-decoration: none; + border-radius: 0.25rem; // 4px + height: 2.25rem; // 36px + padding: 0rem 1rem; // 0px 16px + display: flex; + align-items: flex-start; + justify-content: center; + flex-wrap: wrap; + flex-direction: column; + + &:hover { + background-color: var(--ast-sphinx-gallery-download-background-hover); + } + } + + code.download, + a.reference.download:before { + color: var(--ast-sphinx-gallery-download-text); + } +} + +div.sphx-glr-footer { + text-align: center; + display: flex; + gap: 0.625rem; // 10px + align-content: center; + justify-content: center; + flex-wrap: wrap; + flex-direction: row; +} + +div.sphx-glr-download { + margin: 0rem; // 0px +} diff --git a/src/ansys_sphinx_theme/assets/styles/table-custom.scss b/src/ansys_sphinx_theme/assets/styles/table-custom.scss new file mode 100644 index 000000000..022259420 --- /dev/null +++ b/src/ansys_sphinx_theme/assets/styles/table-custom.scss @@ -0,0 +1,110 @@ +/** + * Table + * + * The table variables. + */ + +.table { + --bs-table-bg: var(--ast-color-table-background); + border-spacing: 0; + border-collapse: separate; + overflow: hidden; + vertical-align: middle; + overflow-y: scroll; + scrollbar-width: none; + -ms-overflow-style: none; + border-color: var(--ast-table-outer-border); + background-color: var(--ast-color-table-background); + + > :not(caption) > * > * { + padding: 0rem 1rem; // 0px 16px + } + + &:hover { + background-color: var(--ast-color-table-row-hover-bg); + } + + &:active { + background-color: var(--ast-color-table-active-bg); + } + + td ~ td, + td ~ th, + th ~ td, + th ~ th, + .bd-content .nboutput .output_area.rendered_html table.dataframe th ~ td { + border-left: 1px solid var(--ast-color-table-inner-border); + } +} + +tbody, +td, +tfoot, +th, +thead, +tr { + border-bottom: 1px solid var(--ast-color-table-inner-border); + background-color: var(--ast-color-table-background); + font-family: var(--ast-font-family-base); + font-size: var(--ast-table-font-size); +} + +/** + * Table header + */ +th { + line-height: 2.5rem; // 40px + color: var(--ast-color-table-header-text) !important; + font-size: var(--ast-table-header-font-size) !important; +} + +/** + * Table body + */ +tr { + line-height: var(--ast-global-line-height); + height: 3.5rem; // 56px + color: var(--ast-color-table-cell-text); +} + +/** + * Table hover + */ +tbody:hover, +td:hover, +tfoot:hover, +th:hover, +thead:hover, +tr:hover { + background-color: var(--ast-color-table-row-hover-bg); + font-family: var(--ast-font-family-base); +} + +/** + * Table dataframes + */ +table.dataframe { + background-color: var(--ast-color-table-background); + + tr { + font-size: var(--ast-table-font-size); + line-height: 3.5rem; // 56px + color: var(--ast-color-table-cell-text); + } + + th { + font-size: var(--ast-table-font-size); + line-height: 2.5rem; // 40px; + color: var(--ast-color-table-header-text) !important; + } + + &:hover { + background-color: var(--ast-color-table-row-hover-bg); + font-family: var(--ast-font-family-base); + } + + &:active { + background-color: var(--ast-color-table-active-bg); + font-family: var(--ast-font-family-base); + } +} diff --git a/src/ansys_sphinx_theme/assets/styles/whatsnew.scss b/src/ansys_sphinx_theme/assets/styles/whatsnew.scss new file mode 100644 index 000000000..791845d27 --- /dev/null +++ b/src/ansys_sphinx_theme/assets/styles/whatsnew.scss @@ -0,0 +1,76 @@ +.whatsnew-sidebar { + /* Sidebar background color */ + background-color: var(--pst-color-background); + margin-bottom: 1.25rem; // 20px to rem + + h2 { + font-size: 1rem; + font-family: var(--ast-font-family-base); + margin-bottom: 0.625rem; // 10px to rem + margin-top: 0.625rem; // 10px to rem + padding: 0.25rem; // 4px to rem + } + + h3 { + font-size: 0.75rem; + font-family: var(--ast-font-family-base); + margin: 0.5rem 0.25rem; // 8px 4px to rem + padding: 0.25rem 0.5rem; // 4px 8px to rem + + &:hover { + color: var(--ast-color-text); + background: var(--ast-sidebar-active-background); + text-decoration: none; + box-shadow: 0.0625rem 0.0625rem 0.125rem 0 var(--ast-sidebar-active-background); // 1px 1px 2px 0px to rem + border-radius: var(--ast-sphinx-design-border-radius); + font-weight: bold; + } + } + + a { + text-decoration: none; + color: var(--ast-color-text); + + &.current { + background: var(--ast-sidebar-active-background); + text-decoration: none; + box-shadow: 0.0625rem 0.0625rem 0.125rem 0 var(--ast-sidebar-active-background); // 1px 1px 2px 0px to rem + border-radius: var(--ast-sphinx-design-border-radius); + font-weight: bold; + padding: 0.25rem 1.5rem 0.25rem 2rem; // 4px 24px 4px 32px to rem + } + + &:hover { + text-decoration: underline; + color: var(--ast-color-text); + } + } + + ul { + list-style: none; + line-height: 1.875rem; // 30px to rem + padding-inline-start: 0rem; + } + + li { + padding: 0.25rem 0.5rem 0.25rem 0.75rem; // 4px 8px 4px 12px to rem + + &:hover { + color: var(--ast-color-text); + background: var(--ast-sidebar-active-background); + text-decoration: none; + box-shadow: 0.0625rem 0.0625rem 0.125rem 0 var(--ast-sidebar-active-background); // 1px 1px 2px 0px to rem + border-radius: var(--ast-sphinx-design-border-radius); + font-weight: bold; + } + + ul { + margin-left: 0.9375rem; // 15px to rem + + li { + list-style-type: disc; /* Bullet points */ + margin-left: 1.25rem; // 20px to rem + } + } + } +} diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/.gitignore b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/.gitignore new file mode 100644 index 000000000..8a1bd6476 --- /dev/null +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/.gitignore @@ -0,0 +1,2 @@ +styles/ansys-sphinx-theme.css +styles/ansys-sphinx-theme.css.map \ No newline at end of file diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/breadcrumbs.css b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/breadcrumbs.css deleted file mode 100644 index 75df543d2..000000000 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/breadcrumbs.css +++ /dev/null @@ -1,108 +0,0 @@ -/* Provided by the Sphinx base theme template at build time, -styles exclusively for the ansys-sphinx-theme classes. */ -/** -* Breadcrumbs -*/ - -ul.bd-breadcrumbs li.breadcrumb-item { - padding: 0px; - font-size: 12px; - display: flex; -} - -ul.bd-breadcrumbs li.breadcrumb-item:hover { - text-decoration: underline; - font-size: 12px; -} - -ul.bd-breadcrumbs li.breadcrumb-item a { - color: var(--ast-navbar-color); - font-size: 12px; -} - -ul.bd-breadcrumbs li.breadcrumb-item a:hover { - text-decoration: underline; -} - -ul.bd-breadcrumbs li.breadcrumb-item a:active { - color: var(--ast-color-text); -} - -.breadcrumb-item.active { - color: var(--ast-color-text); -} - -/** -* Version warning announcement -*/ - -#announcement_msg { - display: flex; - justify-content: center; - position: relative; - width: 100%; - padding: 0.5rem 12.5%; - text-align: center; -} - -#announcement_msg :after { - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; - background-color: rgb(223, 95, 114); - opacity: 0.2; - content: ""; - z-index: -1; -} - -#announcement_msg :empty { - display: none; -} - -#announcement_msg p { - font-weight: var(--ast-font-weight-bold); - margin: auto; - color: black; -} - -html[data-theme="dark"] #announcement_msg :after { - background-color: lightpink; - opacity: 0.5; -} - -#announcement_msg a { - color: var(--ast-color-link); -} - -.sidebar-cheatsheets { - text-align: left; -} - -.sidebar-cheatsheets h4 { - font-weight: 600 !important; - font-size: 1rem !important; - font-family: var(--ast-font-family-base); - color: var(--ast-color-text); -} - -.sidebar-cheatsheets a { - display: inline-flex; - border: 0.5px solid var(--pst-color-border); - padding: 4px 8px 4px 12px; - max-width: 80%; -} - -.sidebar-cheatsheets a:hover { - background-color: var(--pst-color-border); - color: var(--pst-color-text-base); -} - -.sidebar-cheatsheets img { - padding: 0rem; -} - -.bd-sidebar-primary { - padding: 0.5rem; -} diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/sphinx-design.css b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/sphinx-design.css deleted file mode 100644 index 971b7dbf7..000000000 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/sphinx-design.css +++ /dev/null @@ -1,245 +0,0 @@ -/** -* sphinx design button -*/ - -.sd-btn { - font-size: var(--ast-sphinx-design-font-size); - font-weight: var(--ast-font-weight-regular); - font-family: var(--ast-sphinx-design-font-family); - padding: 8px 16px; - border-radius: var(--ast-sphinx-design-border-radius); -} - -.sd-btn-secondary { - font-size: var(--ast-sphinx-design-font-size); - font-weight: var(--ast-font-weight-regular); - font-family: var(--ast-sphinx-design-font-family); - padding: 8px 16px; - border-radius: var(--ast-sphinx-design-border-radius); - color: var(--sd-color-secondary-text); - background-color: var(--sd-color-secondary); - border-color: var(--sd-color-secondary); -} - -blockquote { - background-color: var(--pst-color-background); -} - -/* Media query for medium-sized screens */ -@media screen and (max-width: 768px) { - .sd-card .sd-card-header { - font-size: var(--pst-font-size-h6); - } -} - -/* Media query for small-sized screens */ -@media screen and (max-width: 576px) { - .sd-card .sd-card-header { - font-size: var(--pst-font-size-h5); - } - .sd-card { - padding: 4px; - } -} -/** -* Sphinx-design dropdown -*/ - -.bd-content details.sd-dropdown:not([open]) > .sd-card-header { - border-radius: var(--ast-sphinx-design-border-radius); -} - -.bd-content details.sd-dropdown { - color: var(--ast-dropdown-text-color); - width: fit-content; - min-width: 400px; -} - -.bd-content details.sd-dropdown summary.sd-summary-title { - font-family: var(--ast-sphinx-design-font-family); - font-size: var(--ast-sphinx-design-font-size); - background: var(--ast-color-sphinx-design-background) !important; - border: 1px solid var(--ast-dropdown-border-color) !important; - border-radius: var(--ast-sphinx-design-border-radius); - padding: 8px 12px; - text-align: left; -} - -.bd-content details.sd-dropdown summary.sd-summary-title:hover { - background-color: var(--ast-color-hover-card-background) !important; - border: 1px solid var(--ast-dropdown-border-color-hover) !important; - border-radius: var(--ast-sphinx-design-border-radius); -} - -.bd-content - details.sd-dropdown - summary.sd-card-header - + div.sd-summary-content { - background-color: var(--ast-color-sphinx-design-background); - border-left: none !important; -} - -.bd-content - details.sd-dropdown - .sd-summary-title:active - + div.sd-summary-content:active { - background-color: var(--ast-color-enable-card-background); - border-color: var(--ast-color-enable-border); -} - -.bd-content - details.sd-dropdown - .sd-summary-title:hover - + div.sd-summary-content:hover { - background-color: var(--ast-color-hover-card-background); - border-color: var(--ast-color-hover-border); - border-left: none; -} - -.bd-content - details.sd-dropdown - summary.sd-summary-title:focus - + div.sd-summary-content:focus { - background-color: var(--ast-color-sphinx-design-background); - border-radius: var(--ast-sphinx-design-border-radius); - border-color: var(--pst-color-border); - border-left: none; -} - -details.sd-dropdown summary.sd-card-header + div.sd-summary-content { - color: var(--ast-color-sphinx-design-primary); - font-family: var(--ast-sphinx-design-font-family); - font-size: var(--ast-sphinx-design-font-size); -} - -/** -* Sphinx-design tab -*/ - -.bd-content .sd-tab-set > label { - font-family: var(--ast-sphinx-design-font-family); - padding: 12px 0px; - border-style: none none solid none; - color: var(--ast-color-sphinx-design-primary); - font-size: var(--ast-sphinx-design-font-size); - margin-inline-end: 16px; - transform: none; - margin-bottom: 1px; -} - -.bd-content .sd-tab-set > input:checked + label:hover, -.bd-content .sd-tab-set > input:not(:checked, :focus-visible) + label:hover { - color: var(--ast-color-sphinx-design-primary); - font-family: var(--ast-sphinx-design-font-family); -} - -.bd-content .sd-tab-set > input + label:focus-visible, -.bd-content - .sd-tab-set - > input:not(:checked, :focus-visible) - + label:focus-visible { - background-color: var(--ast-background-tab-focus); - border-color: transparent transparent var(--ast-tab-border-color-hover) - transparent; - border-width: 0px 0px 2px 0px; - text-decoration-line: none; -} - -.bd-content .sd-tab-set > input:checked + label { - background-color: transparent; - border-color: transparent transparent var(--ast-tab-border-color-active) - transparent; - border-width: 0px 0px 2px 0px; - border-style: none none solid none; - transform: none; -} - -.bd-content .sd-tab-set > input:checked + label:hover { - background-color: var(--ast-background-tab-hover); - border-color: transparent transparent var(--ast-tab-border-color-hover) - transparent; - border-width: 0px 0px 2px 0px; -} - -.bd-content .sd-tab-set > input:not(:checked, :focus-visible) + label { - background-color: transparent; - border-color: transparent transparent var(--ast-tab-border-color) transparent; - border-width: 0px 0px 1px 0px; - text-decoration-line: none; - font-weight: var(--ast-font-weight-regular); -} - -.bd-content .sd-tab-set > input:not(:checked, :focus-visible) + label:hover { - background-color: var(--ast-background-tab-hover); - border-color: transparent transparent var(--ast-tab-border-color-hover) - transparent; - border-width: 0px 0px 2px 0px; - border-style: none none solid none; - text-decoration: none; -} - -.bd-content .sd-tab-set .sd-tab-content { - border: none; - font-family: var(--ast-sphinx-design-font-family); - font-size: var(--ast-sphinx-design-font-size); - color: var(--ast-color-sphinx-design-primary); -} - -/* Media query for medium-sized screens */ -@media screen and (max-width: 768px) { - .sd-tab-set > input:not(.focus-visible) + label { - font-size: 14px; - } -} - -/* Media query for small-sized screens */ -@media screen and (max-width: 576px) { - .sd-tab-set > input:not(.focus-visible) + label { - font-size: 12px; - } -} - -/** -* Sphinx-design card -*/ - -.bd-content .sd-card .sd-card-body, -.bd-content .sd-card .sd-card-footer { - font-size: var(--ast-sphinx-design-font-size); - border: none; - background-color: var(--ast-color-sphinx-design-background); - font-family: var(--ast-sphinx-design-font-family); - color: var(--ast-color-sphinx-design-primary); - border-radius: 8px; -} - -.bd-content .sd-card .sd-card-title, -.bd-content .sd-card .sd-card-header { - font-size: 16px; - border: none; - background-color: var(--ast-color-sphinx-design-background); - font-family: var(--ast-sphinx-design-font-family); - line-height: 24px; -} - -.bd-content .sd-card { - border: none; - border-radius: 8px; - box-shadow: var(--ast-box-shadow-hover) !important; - color: var(--ast-color-sphinx-design-primary); - background-color: var(--ast-color-sphinx-design-background); -} - -.bd-content .sd-card:hover { - box-shadow: var(--ast-box-shadow-hover) !important; -} - -.sd-hide-link-text:focus { - outline: none; - box-shadow: none; -} - -.bd-content .sd-card .sd-stretched-link:focus-visible:after { - outline: none; - box-shadow: var(--ast-ring-shadow-focused); -} diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/sphinx-gallery.css b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/sphinx-gallery.css deleted file mode 100644 index 6d6078f30..000000000 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/sphinx-gallery.css +++ /dev/null @@ -1,64 +0,0 @@ -/** -* Sphinx gallery output cell -*/ - -.highlight pre { - font-size: 0.9em; -} - -/** -* Sphinx gallery download button text -*/ - -a > code.download { - font-family: var(--pst-font-family-base); - color: var(--pst-color-link); - text-decoration: none; - font-weight: var(--ast-font-weight-regular); -} - -div.sphx-glr-download a, -div.sphx-glr-download a:hover { - background-image: none; - color: var(--ast-sphinx-gallery-download-text); - text-decoration: none; - border-radius: 4px; - height: 36px; - padding: 0px 16px; - display: flex; - align-items: flex-start; - justify-content: center; - flex-wrap: wrap; - flex-direction: column; -} -div.sphx-glr-download code.download, -div.sphx-glr-download a.reference.download:before { - color: var(--ast-sphinx-gallery-download-text); -} - -a.reference.download:before { - color: var(--ast-color-text); -} - -div.sphx-glr-download a:hover { - background-color: var(--ast-sphinx-gallery-download-background-hover); -} - -div.sphx-glr-download a { - background-color: var(--ast-sphinx-gallery-download-background); - color: var(--ast-sphinx-gallery-download-text); -} - -div.sphx-glr-footer { - text-align: center; - display: flex; - gap: 10px; - align-content: center; - justify-content: center; - flex-wrap: wrap; - flex-direction: row; -} - -div.sphx-glr-download { - margin: 0px; -} diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/table-custom.css b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/table-custom.css deleted file mode 100644 index 5411d1b79..000000000 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/table-custom.css +++ /dev/null @@ -1,116 +0,0 @@ -/** -* Table -* -* the table variables. -*/ - -.table { - --bs-table-bg: var(--ast-color-table-background); - border-spacing: 0; - border-collapse: separate; - overflow: hidden; - vertical-align: middle; - overflow-y: scroll; - scrollbar-width: none; - -ms-overflow-style: none; - border-color: var(--ast-table-outer-border); - background-color: var(--ast-color-table-background); -} - -tbody, -td, -tfoot, -th, -thead, -tr { - border-bottom: 1px solid var(--ast-color-table-inner-border); - background-color: var(--ast-color-table-background); - font-family: var(--ast-font-family-base); - font-size: var(--ast-table-font-size); -} - -.table > :not(caption) > * > * { - padding: 0px 16px; -} - -/** -* Table header -*/ -th { - line-height: 40px; - color: var(--ast-color-table-header-text) !important; - font-size: var(--ast-table-header-font-size) !important; -} - -/** -* Table body -*/ - -tr { - line-height: var(--ast-global-line-height); - height: 56px; - color: var(--ast-color-table-cell-text); -} - -/** -* Table hover -*/ - -tbody :hover, -td :hover, -tfoot :hover, -th :hover, -thead :hover, -tr :hover { - background-color: var(--ast-color-table-row-hover-bg); - font-family: var(--ast-font-family-base); -} - -.table :hover { - background-color: var(--ast-color-table-row-hover-bg); -} - -/** -* Table active -*/ - -.table :active { - background-color: var(--ast-color-table-active-bg); -} -/** -* Table dataframes -*/ - -table.dataframe tr { - font-size: var(--ast-table-font-size); - line-height: 56px; - color: var(--ast-color-table-cell-text); -} - -table.dataframe th { - font-size: var(--ast-table-font-size); - line-height: 40px; - color: var(--ast-color-table-header-text) !important; -} - -table.dataframe :hover { - background-color: var(--ast-color-table-row-hover-bg); - font-family: var(--ast-font-family-base); -} - -table.dataframe :active { - background-color: var(--ast-color-table-active-bg); - font-family: var(--ast-font-family-base); -} - -table.dataframe { - background-color: var(--ast-color-table-background); -} - -.table td ~ td, -.table td ~ th, -.table th ~ td, -.table th ~ th, -.bd-content .nboutput .output_area.rendered_html table.dataframe th ~ td { - border-left: 1px solid var(--ast-color-table-inner-border); -} diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/whatsnew.css b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/whatsnew.css deleted file mode 100644 index 3a12f97a0..000000000 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/whatsnew.css +++ /dev/null @@ -1,79 +0,0 @@ -.whatsnew-sidebar { - /* border: 1px solid var(--ast-color-table-inner-border); */ - background-color: var(--pst-color-background); - /* border-radius: 10px; */ - /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); */ - margin-bottom: 20px; -} - -.whatsnew-sidebar h2 { - font-size: 1rem; - font-family: var(--ast-font-family-base); - margin-bottom: 10px; - margin-top: 10px; - padding: 4px; -} - -.whatsnew-sidebar h3 { - font-size: 0.75rem; - font-family: var(--ast-font-family-base); - margin: 8px 4px; - padding: 4px 8px; -} - -.whatsnew-sidebar a.current { - color: var(--ast-color-text); - background: var(--ast-sidebar-active-background); - text-decoration: none; - box-shadow: 1px 1px 2px 0px var(--ast-sidebar-active-background); - border-radius: var(--ast-sphinx-design-border-radius); - font-weight: bold; - padding: 4px 24px 4px 32px; -} - -.whatsnew-sidebar h3:hover { - color: var(--ast-color-text); - background: var(--ast-sidebar-active-background); - text-decoration: none; - box-shadow: 1px 1px 2px 0px var(--ast-sidebar-active-background); - border-radius: var(--ast-sphinx-design-border-radius); - font-weight: bold; -} - -.whatsnew-sidebar ul { - list-style: none; - line-height: 30px; - padding-inline-start: 0rem; -} - -.whatsnew-sidebar li { - padding: 4px 8px 4px 12px; -} - -.whatsnew-sidebar li:hover { - color: var(--ast-color-text); - background: var(--ast-sidebar-active-background); - text-decoration: none; - box-shadow: 1px 1px 2px 0px var(--ast-sidebar-active-background); - border-radius: var(--ast-sphinx-design-border-radius); - font-weight: bold; -} - -.whatsnew-sidebar li ul { - margin-left: 15px; /* Indent sub-items */ -} - -.whatsnew-sidebar li ul li { - list-style-type: disc; /* Bullet points */ - margin-left: 20px; /* Spacing for bullet points */ -} - -.whatsnew-sidebar a { - text-decoration: none; /* Remove underline */ - color: var(--ast-color-text); /* Blue link color */ -} - -.whatsnew-sidebar a:hover { - text-decoration: underline; /* Underline on hover */ - color: var(--ast-color-text); /* Blue link color on hover */ -}