Skip to content

Conversation

@conradolandia
Copy link
Contributor

This PR improves QDarkStyleSheet documentation to reflect recent API changes and address missing user guidance.

Changes made:

Enhanced Main API Documentation (qdarkstyle/__init__.py):

  • Added comprehensive documentation for the palette parameter in load_stylesheet()
  • Fixed contradictory Python version support information
  • Added practical usage examples with DarkPalette/LightPalette
  • Marked pyside parameter as deprecated

Complete Palette System Documentation (docs/color_reference.rst):

  • Documented all palette constants (Background, Text, Accent colors)
  • Added hexadecimal color values for Dark and Light themes
  • Included usage examples in Python and SCSS/CSS

Custom Palettes Creation Guide (docs/custom_palettes.rst):

  • Added guide for creating custom themes
  • Complete workflow from creation to deployment
  • Best practices and troubleshooting documentation

Utils CLI Documentation (docs/scripts/qdarkstyle_utils.rst):

  • Documented python -m qdarkstyle.utils command-line interface
  • Added practical examples for resource generation

Technical improvements:

  • Fixed Sphinx build warnings
  • Added cross-references between sections
  • Integrated new documentation into main index structure

Impact:

  • Addresses missing API documentation gaps
  • Provides complete guidance for custom theme creation
  • Improves developer experience with clear examples

@conradolandia
Copy link
Contributor Author

@dalthviz would you take a look at these updates to see if I'm missing something or got anything wrong?

Copy link

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @conradolandia ! Left some initial suggestions/comments (a suggestion for a table with a duplicated column) and a comment on the documentation regarding the usage of load_stylesheet (I think that function doesn't support custom palettes).

@conradolandia
Copy link
Contributor Author

Thank you for your suggestions, @dalthviz! I fully rewrote docs/custom_palettes.rst and tried to verify all functionality for the examples, please let me know if you think something is inaccurate and/or missing. Also modified the documentation in load_stylesheet to clarify the supported palettes. I don't understand very well this part, because we have palette = kwargs.get('palette', None) at line 387 and elif 'palette' in kwargs or issubclass(arg, Palette) at line 423, so I guess it could take personalized palettes, or I'm wrong?

@dalthviz
Copy link

Also modified the documentation in load_stylesheet to clarify the supported palettes. I don't understand very well this part, because we have palette = kwargs.get('palette', None) at line 387 and elif 'palette' in kwargs or issubclass(arg, Palette) at line 423, so I guess it could take personalized palettes, or I'm wrong?

From my check, although the public function load_stylesheet doesn't have logic to validate that an arbitrary palette definition is being passed, the private function _load_styleheet (that actually does the resources load) has this validation:

# Then we import resources - binary qrc content
if palette is None:
from qdarkstyle.dark import darkstyle_rc # noqa
palette = DarkPalette
elif palette.ID == 'dark':
from qdarkstyle.dark import darkstyle_rc # noqa
palette = DarkPalette
elif palette.ID == 'light':
from qdarkstyle.light import lightstyle_rc # noqa
palette = LightPalette
else:
print("Not recognized ID for palette! Exiting!")
sys.exit(1)

In that function, if you pass as palette value None the DarkPalette will be loaded by default and, in case you try to load passing as palette value a palette class definition with something different than light or dark as ID (i.e DarkPalette or LightPalette related IDs), a message will be printed indicating that the palette is not recognized and the Python process will be exited.

So basically load_stylesheet ends up only supporting for the palette kwarg the None, DarkPalette and LightPalette values (or at least palette class definitions that use those palettes IDs) and can only load DarkPalette and LightPalette resources

@conradolandia
Copy link
Contributor Author

conradolandia commented Jul 18, 2025

Thanks for your comments @dalthviz, this is again ready for review!

Copy link

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @conradolandia ! Left some further comments/suggestions

@conradolandia
Copy link
Contributor Author

Thanks @dalthviz, I updated the documentation taking into account your comments, updated CONTRIBUTING.rst and also added a new file with a demo for custom theme creation.

conradolandia and others added 2 commits July 24, 2025 18:51
Co-authored-by: Daniel Althviz Moré <16781833+dalthviz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants