A portable, modern theme implementation of CKAN's classic Midnight Blue theme, fully integrated with ckanext-theming.
By implementing the ckanext-theming workflow, this extension replaces traditional inline HTML/CSS templates with standard, decoupled UI macros. This ensures that the aesthetic and look of the original Midnight Blue theme is preserved while introducing a clean, maintainable, and modern macro-based architecture.
This extension provides a faithful port of the original Midnight Blue theme but includes several modern layout improvements:
- Modern Layouts: Primary content layout blocks no longer rely on CSS float. Instead, they leverage native Bootstrap 5 grid layout classes (
col). - Enhanced Page Layout Flexibility: Integrates the flexible layout blocks structure, allowing you to easily customize the page layout. For example, add
{% block page_layout %}no-sidebar{% endblock %}to hide the sidebar, or set it tosidebar-endto move the sidebar to the right. - Refined Form Validation Style: Employs Bootstrap 5 native styling for field validation errors. Fields with errors have a clean red outline and red helper text without a heavy red background, resulting in a cleaner UI.
- Optimized Rendering: Cleaned up unnecessary markup; blocks such as
header_account_notloggedare not rendered when a user is logged in, rather than rendering empty elements.
This extension registers the following theme with the ckanext-theming framework:
midnight-blue-portable: The primary theme applying the clean, professional Midnight Blue layout and styles.
| CKAN version | Compatible? |
|---|---|
| 2.11 and earlier | no |
| 2.12 | yes |
Note
This extension requires ckanext-theming to run.
Below are placeholders for screenshots of the Midnight Blue Portable theme in action:
Activate your CKAN virtual environment and install ckanext-midnight-blue-theme and ckanext-theming:
pip install ckanext-theming
# Install ckanext-midnight-blue-theme from source or pip
pip install ckanext-midnight-blue-themeOr for development/source installation:
git clone https://github.com/DataShades/ckanext-midnight-blue-theme.git
cd ckanext-midnight-blue-theme
pip install -e .Add both theming and midnight_blue_theme to the ckan.plugins list in your ckan.ini file:
ckan.plugins = ... theming midnight_blue_themeSet midnight-blue-portable as the active theme in your ckan.ini configuration:
ckan.ui.theme = midnight-blue-portableTip
Consider pinning ckanext-theming to a specific version (e.g. ckanext-theming==X.Y.Z) in your project's main requirements.
This extension exposes several template helpers:
get_dataset_count(): Returns the total number of datasets on the CKAN instance.get_recent_datasets(count=1): Returns a list of the most recently modified or created datasets.default_collapse_facets(): Returns a boolean indicating if facets in the secondary sidebar should be collapsed by default (configured viackan.default_collapse_facets).currently_active_facet(facet): Returns a boolean indicating if a specific facet is currently active or expanded in the request parameters.
If you'd like to run the test suite, run:
pytest

