Skip to main content

CSS syntax highlighting for the Thonny editor

Project description

Thonny CSS Highlighter

A small Thonny front-end plug-in that adds syntax highlighting for .css files. It is designed primarily for viewing and editing CSS in teaching projects where HTML, CSS, and Python files are kept together.

Highlighted constructs

  • block comments and quoted strings
  • selectors, classes, IDs, pseudo-classes, and pseudo-elements
  • property names and custom properties
  • at-rules and !important
  • numbers, dimensions, percentages, and hexadecimal colors
  • CSS functions such as var(), calc(), clamp(), and rgb()
  • common CSS value keywords
  • nested rules and common rule-list at-rules such as @media, @supports, @container, @layer, and @keyframes

The plug-in reuses Thonny's standard syntax-theme tags. Consequently, CSS highlighting follows the syntax theme selected under Tools → Options → Theme & Font.

Install the wheel

  1. Open Thonny.
  2. Select Tools → Manage plug-ins.
  3. Choose Install from local file.
  4. Select thonny_css_highlighter-0.1.0-py3-none-any.whl.
  5. Restart Thonny.
  6. Open a .css file.

The source directory can also be installed during development:

python -m pip install -e .

Run tests with:

python -m pytest

Compatibility

The package requires Python 3.10 or newer and targets Thonny 4.1 through 5.x. It uses Thonny's current plug-in convention: a package below the thonnycontrib namespace with a parameterless load_plugin() function.

Implementation note

Thonny's built-in colorer is Python-specific and clears the standard theme tags for non-Python files. This plug-in bypasses that colorer only for editors whose file type is css, then applies its own tolerant lexer. Other editor types keep Thonny's normal behavior.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thonny_css_highlighter-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thonny_css_highlighter-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file thonny_css_highlighter-0.1.0.tar.gz.

File metadata

  • Download URL: thonny_css_highlighter-0.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for thonny_css_highlighter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5deb21e6fe6f5e4226ebca6fa12a2e196827dc76e26104415c1b83028da8722a
MD5 03367c197c00954f7796962a65a829f6
BLAKE2b-256 0c14a301f8e199bfe1e5300c3528874ddad7ec2d064bc9a4b2c45cf36f8f99c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for thonny_css_highlighter-0.1.0.tar.gz:

Publisher: ci-publish.yml on acbart/thonny-css-highlighter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thonny_css_highlighter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for thonny_css_highlighter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2401686d43e0042f53a78e93002cce08acd1ae39a019718203974b88200095bc
MD5 7930c1a8649249389ce8cd20cb6204dd
BLAKE2b-256 2c27432526f591386b92a6f8e969430e5c849be926eb376e86710e81582ad9af

See more details on using hashes here.

Provenance

The following attestation bundles were made for thonny_css_highlighter-0.1.0-py3-none-any.whl:

Publisher: ci-publish.yml on acbart/thonny-css-highlighter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page