Repository: pvlib/pvlib-python

Issue:
Dark mode for hoverxref tooltips
This is a follow up to #2290
**Is your feature request related to a problem? Please describe.**
While the new tooltips do display in both dark and light mode, the tooltips themselves only show in light mode

**Describe the solution you'd like**
Enable dark mode tooltips for when the docs are being viewed in dark mode

**Describe alternatives you've considered**
Leaving the light mode tooltips to show when the docs are being viewed in dark mode... not a disaster, but not ideal

**Additional context**
Discussion in #2290

Hints from issue comments:

Solution patch:
diff --git a/docs/sphinx/source/_static/tooltipster_color_theming.css b/docs/sphinx/source/_static/tooltipster_color_theming.css
new file mode 100644
index 0000000..5804459
--- /dev/null
+++ b/docs/sphinx/source/_static/tooltipster_color_theming.css
@@ -0,0 +1,10 @@
+/* Overrides for sphinx-hoverxref since it does not support a native dark theme, see */
+/* https://github.com/readthedocs/sphinx-hoverxref/issues/231 */
+/* Inspired by https://github.com/pybamm-team/PyBaMM/pull/3083 */
+
+/* These will ensure that the tooltip inherits the pydata-sphinx-theme colours */
+
+.tooltipster-sidetip.tooltipster-shadow.tooltipster-shadow-custom .tooltipster-content {
+    background-color: var(--pst-color-background) !important;
+    color: var(--pst-color-text-base) !important;
+}
diff --git a/docs/sphinx/source/conf.py b/docs/sphinx/source/conf.py
index a08507c..5c1a85d 100644
--- a/docs/sphinx/source/conf.py
+++ b/docs/sphinx/source/conf.py
@@ -282,6 +282,8 @@ def setup(app):
     app.add_css_file("reference_format.css")
     # Add a warning banner at the top of the page if viewing the "latest" docs
     app.add_js_file("version-alert.js")
+    # Match the color theme of tooltips to PyData Sphinx Theme light/dark mode
+    app.add_css_file("tooltipster_color_theming.css")
 
 # -- Options for LaTeX output ---------------------------------------------
 
diff --git a/docs/sphinx/source/user_guide/nomenclature.rst b/docs/sphinx/source/user_guide/nomenclature.rst
index f361690..4c983dc 100644
--- a/docs/sphinx/source/user_guide/nomenclature.rst
+++ b/docs/sphinx/source/user_guide/nomenclature.rst
@@ -71,6 +71,9 @@ There is a convention on consistent variable names throughout the library:
     ghi
         Global horizontal irradiance
 
+    ghi_clear
+        Clearsky global horizontal irradiance [Wm⁻²]
+
     ghi_extra
         Horizontal irradiance at top of atmosphere (extraterrestrial)
 
diff --git a/docs/sphinx/source/whatsnew/v0.11.3.rst b/docs/sphinx/source/whatsnew/v0.11.3.rst
index 6363275..ecf6f2d 100644
--- a/docs/sphinx/source/whatsnew/v0.11.3.rst
+++ b/docs/sphinx/source/whatsnew/v0.11.3.rst
@@ -16,12 +16,14 @@ Enhancements
   ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`)
 * Fix a bug where :py:func:`pvlib.transformer.simple_efficiency` could only be imported
   using the `from pvlib.transformer` syntax (:pull:`2388`)
+* Correct keys for First Solar modules in `~pvlib.spectrum.spectral_factor_pvspec` (:issue:`2398`, :pull:`2400`)
 
 Documentation
 ~~~~~~~~~~~~~
 * Fix Procedural and Object Oriented simulation examples having slightly different results, in :ref:`introtutorial`. (:issue:`2366`, :pull:`2367`)
 * Restructure the user guide with subsections (:issue:`2302`, :pull:`2310`)
 * Add references for :py:func:`pvlib.snow.loss_townsend`. (:issue:`2383`, :pull:`2384`)
+* Add :term:`ghi_clear` to the :ref:`nomenclature` page (:issue:`2272`, :pull`2397`)
 
 Testing
 ~~~~~~~
diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py
index 3afc210..980f0d0 100644
--- a/pvlib/spectrum/mismatch.py
+++ b/pvlib/spectrum/mismatch.py
@@ -520,7 +520,7 @@ def spectral_factor_pvspec(airmass_absolute, clearsky_index,
         One of the following PV technology strings from [1]_:
 
         * ``'fs4-1'`` - First Solar series 4-1 and earlier CdTe module.
-        * ``'fs4-2'`` - First Solar 4-2 and later CdTe module.
+        * ``'fs4-2'`` - First Solar series 4-2 and later CdTe module.
         * ``'monosi'`` - anonymous monocrystalline Si module.
         * ``'multisi'`` - anonymous multicrystalline Si module.
         * ``'cigs'`` - anonymous copper indium gallium selenide module.
@@ -576,8 +576,8 @@ def spectral_factor_pvspec(airmass_absolute, clearsky_index,
     _coefficients = {}
     _coefficients['multisi'] = (0.9847, -0.05237, 0.03034)
     _coefficients['monosi'] = (0.9845, -0.05169, 0.03034)
-    _coefficients['fs-2'] = (1.002, -0.07108, 0.02465)
-    _coefficients['fs-4'] = (0.9981, -0.05776, 0.02336)
+    _coefficients['fs4-2'] = (1.002, -0.07108, 0.02465)
+    _coefficients['fs4-1'] = (0.9981, -0.05776, 0.02336)
     _coefficients['cigs'] = (0.9791, -0.03904, 0.03096)
     _coefficients['asi'] = (1.051, -0.1033, 0.009838)
 
diff --git a/pyproject.toml b/pyproject.toml
index 8464b7c..b368cc7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -66,7 +66,7 @@ doc = [
     'sphinx-toggleprompt == 0.5.2',
     'sphinx-favicon',
     'solarfactors',
-    'sphinx-hoverxref',
+    'sphinx-hoverxref ~= 1.4.2',  # when updating, check that _static/tooltipster_color_theming.css still works
 ]
 test = [
     'pytest',


Test patch:
diff --git a/pvlib/tests/spectrum/test_mismatch.py b/pvlib/tests/spectrum/test_mismatch.py
index 5397a81..ed22577 100644
--- a/pvlib/tests/spectrum/test_mismatch.py
+++ b/pvlib/tests/spectrum/test_mismatch.py
@@ -202,8 +202,8 @@ def test_spectral_factor_caballero_supplied_ambiguous():
 
 @pytest.mark.parametrize("module_type,expected", [
     ('asi', np.array([1.15534029, 1.1123772, 1.08286684, 1.01915462])),
-    ('fs-2', np.array([1.0694323, 1.04948777, 1.03556288, 0.9881471])),
-    ('fs-4', np.array([1.05234725, 1.037771, 1.0275516, 0.98820533])),
+    ('fs4-2', np.array([1.0694323, 1.04948777, 1.03556288, 0.9881471])),
+    ('fs4-1', np.array([1.05234725, 1.037771, 1.0275516, 0.98820533])),
     ('multisi', np.array([1.03310403, 1.02391703, 1.01744833, 0.97947605])),
     ('monosi', np.array([1.03225083, 1.02335353, 1.01708734, 0.97950110])),
     ('cigs', np.array([1.01475834, 1.01143927, 1.00909094, 0.97852966])),
@@ -218,8 +218,8 @@ def test_spectral_factor_pvspec(module_type, expected):
 
 @pytest.mark.parametrize("module_type,expected", [
     ('asi', pd.Series([1.15534029, 1.1123772, 1.08286684, 1.01915462])),
-    ('fs-2', pd.Series([1.0694323, 1.04948777, 1.03556288, 0.9881471])),
-    ('fs-4', pd.Series([1.05234725, 1.037771, 1.0275516, 0.98820533])),
+    ('fs4-2', pd.Series([1.0694323, 1.04948777, 1.03556288, 0.9881471])),
+    ('fs4-1', pd.Series([1.05234725, 1.037771, 1.0275516, 0.98820533])),
     ('multisi', pd.Series([1.03310403, 1.02391703, 1.01744833, 0.97947605])),
     ('monosi', pd.Series([1.03225083, 1.02335353, 1.01708734, 0.97950110])),
     ('cigs', pd.Series([1.01475834, 1.01143927, 1.00909094, 0.97852966])),