Skip to content

Commit

Permalink
Merge qiskit and qiskit-ecosystem theme implementation (#583)
Browse files Browse the repository at this point in the history
The two themes are now equivalent and there is no longer an `/ecosystem`
folder with overrides.

A follow up PR will remove the `qiskit` theme.

## Removes blue color code

This was only used for IBM Provider and IBM Runtime, which both now live
at docs.quantum.ibm.com. We never wanted other projects to use the color
scheme.

Technically projects can still override their color by changing
`conf.py`, since Furo itself allows that. But we don't advertise it for
now.
  • Loading branch information
Eric-Arellano authored Dec 5, 2023
1 parent 985654c commit 5bca8e3
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 89 deletions.
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,6 @@ html_theme_options = {
}
```

## IBM Projects: how to use blue color scheme for Ecosystem theme

By default, the `qiskit-ecosystem` theme uses purple as an accent color. Most projects should continue to use this, but certain highly IBM-affiliated projects like Qiskit IBM Runtime can change the accent color to blue by setting up `conf.py` like this:

```python
# Only intended for specific IBM projects.
html_theme_options = {
"light_css_variables": {
"color-brand-primary": "var(--qiskit-color-blue)",
}
}
```

## Tip: suggested site structure

To keep UX/UI similar across different Qiskit packages, we encourage the following structure for you sidebar, which can be set in the toctree of your `index.rst`:
Expand Down
11 changes: 0 additions & 11 deletions example_docs/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"sphinx.ext.autosummary",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx.ext.extlinks",
"jupyter_sphinx",
"sphinx_copybutton",
"sphinx_design",
Expand All @@ -64,16 +63,6 @@
_THEME = os.getenv("THEME", "qiskit")
html_theme = _THEME

if _THEME == "qiskit-ecosystem":
# This tests out that ecosystem projects can change the color scheme.
# Only specific IBM projects should set this! Most Ecosystem projects
# should use the default of purple.
html_theme_options = {
"light_css_variables": {
"color-brand-primary": "var(--qiskit-color-blue)",
}
}

html_context = {
# Users of the theme can set prior version numbers. They'll
# show up in the sidebar under the "Previous Versions" section.
Expand Down
2 changes: 1 addition & 1 deletion src/qiskit_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def setup(app: sphinx.application.Sphinx) -> dict[str, bool]:
translations.setup(app)

app.add_html_theme("qiskit", _get_theme_absolute_path("theme/qiskit-sphinx-theme"))
app.add_html_theme("qiskit-ecosystem", _get_theme_absolute_path("ecosystem"))
app.add_html_theme("qiskit-ecosystem", _get_theme_absolute_path("theme/qiskit-sphinx-theme"))

app.connect("config-inited", activate_furo)
app.connect("html-page-context", remove_thebe_if_not_needed)
Expand Down
6 changes: 2 additions & 4 deletions src/qiskit_sphinx_theme/assets/styles/_colors.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
body {
// Define some Carbon color schemes from
// Define the Carbon color schemes from
// https://github.com/carbon-design-system/carbon/blob/v10/packages/colors/src/colors.js
// that are consistent with Qiskit's branding.
//
// While we set default colors, IBM-focused projects will want to use blue.
// Projects can override `--color-brand-primary` to whatever they want.
--qiskit-color-purple: #6929C4; // purple70
--qiskit-color-blue: #0043ce; // blue70

// Furo normally distinguishes between these two variables, but
// we want them to be the same.
Expand Down
11 changes: 11 additions & 0 deletions src/qiskit_sphinx_theme/assets/styles/_left-sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ body {
text-transform: unset;
}


// ------------------------------------------------------------------------------
// Logos
// ------------------------------------------------------------------------------

// Furo only sets `max-width` to 100%, and height stays at `auto`. That results in
// logos appearing small in the in the left sidebar.
.sidebar-logo {
width: 100%;
}

// --------------------------------------------------------------------------------------
// Common config for Translations & Previous Releases
// --------------------------------------------------------------------------------------
Expand Down

This file was deleted.

31 changes: 0 additions & 31 deletions src/qiskit_sphinx_theme/ecosystem/theme.conf

This file was deleted.

4 changes: 4 additions & 0 deletions src/qiskit_sphinx_theme/theme/qiskit-sphinx-theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ inherit = furo
stylesheet = styles/qiskit-sphinx-theme.css

sidebars =
custom_templates/sidebar_brand.html,
sidebar/search.html,
sidebar/scroll-start.html,
sidebar/navigation.html,
custom_templates/sidebar_version_list.html,
sidebar/scroll-end.html,
custom_templates/sidebar_languages.html

[options]
disable_ecosystem_logo =
11 changes: 0 additions & 11 deletions tests/js/ecosystem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,8 @@

import { expect, test } from "@playwright/test";

import { click } from "./utils";

test("left side bar renders correctly", async ({ page }) => {
await page.goto("");
const leftToC = page.locator(".sidebar-drawer");
await expect(leftToC).toHaveScreenshot();
});

test.describe("colors can be changed", () => {
test("translations", async ({ page }) => {
await page.goto("");
await click(page, "div.qiskit-translations-container i");
const translations = page.locator("div.qiskit-translations-container");
await expect(translations).toHaveScreenshot();
});
});
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5bca8e3

Please sign in to comment.