Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dark + light mode option #809 #826

Merged
merged 7 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/config.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,6 @@ views.root = "themes/twentysixteen"

; Framework config. No need to edit.
views.layout = "layout"

; Admin theme: light or dark mode
admin.theme = "dark"
1 change: 1 addition & 0 deletions lang/en_US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,4 @@ msg_error_field_req_feedurl = "You need to specify the feed url."
rss_feeds_description_select = "RSS Description"
rss_description_body = "Post Body"
rss_description_meta = "Post Meta Description"
admin_theme = "Admin theme"
2 changes: 1 addition & 1 deletion system/admin/views/add-content.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function extractLast( term ) {
<div class="col-sm-6" id="preview-col">
<label><?php echo i18n('Preview');?></label>
<br>
<div id="wmd-preview" class="wmd-panel wmd-preview" style="width:100%;overflow:auto;"></div>
<div id="wmd-preview" class="wmd-panel wmd-preview <?php if (config('admin.theme') === 'dark'){echo "card";}?>" style="width:100%;overflow:auto;"></divd
</div>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion system/admin/views/add-page.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<div class="col-sm-6" id="preview-col">
<label><?php echo i18n('Preview');?></label>
<br>
<div id="wmd-preview" class="wmd-panel wmd-preview" style="width:100%;overflow:auto;"></div>
<div id="wmd-preview" class="wmd-panel wmd-preview <?php if (config('admin.theme') === 'dark'){echo "card";}?>" style="width:100%;overflow:auto;"></div>
</div>
</div>
</form>
Expand Down
22 changes: 22 additions & 0 deletions system/admin/views/config.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,28 @@
<small><em><?php echo i18n('explain_version');?></em></small>
</div>
</div>

<div class="form-group row">
<label class="col-sm-2 col-form-label"><?php echo i18n('admin_theme');?></label>
<div class="col-sm-10">
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="radio" name="-config-admin.theme" id="admin.theme1" value="light" <?php if (config('admin.theme') === 'light' || is_null(config('admin.theme'))):?>checked<?php endif;?>>
<label class="form-check-label" for="admin.theme1">
Light
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="-config-admin.theme" id="admin.theme2" value="dark" <?php if (config('admin.theme') === 'dark'):?>checked<?php endif;?>>
<label class="form-check-label" for="admin.theme2">
Dark
</label>
</div>
</div>
</div>
</div>


<hr />
<div class="form-group row">
<div class="col-sm-10">
Expand Down
2 changes: 1 addition & 1 deletion system/admin/views/edit-content.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function extractLast( term ) {
<div class="col-sm-6" id="preview-col">
<label><?php echo i18n('Preview');?></label>
<br>
<div id="wmd-preview" class="wmd-panel wmd-preview" style="width:100%;overflow:auto;"></div>
<div id="wmd-preview" class="wmd-panel wmd-preview <?php if (config('admin.theme') === 'dark'){echo "card";}?>" style="width:100%;overflow:auto;"></div>
</div>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion system/admin/views/edit-page.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<div class="col-sm-6" id="preview-col">
<label><?php echo i18n('Preview');?></label>
<br>
<div id="wmd-preview" class="wmd-panel wmd-preview" style="width:100%;overflow:auto;"></div>
<div id="wmd-preview" class="wmd-panel wmd-preview <?php if (config('admin.theme') === 'dark'){echo "card";}?>" style="width:100%;overflow:auto;"></div>
</div>
</div>
</form>
Expand Down
8 changes: 4 additions & 4 deletions system/admin/views/layout.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
header("Location: $url");
}
?>
<body class="hold-transition sidebar-mini">
<body class="hold-transition sidebar-mini <?php echo ((config('admin.theme') === 'light' || is_null(config('admin.theme'))) ? "light-mode" : "dark-mode"); ?>">
<div id="top"></div>
<div class="wrapper">
<style>.error-message ul {margin:0;padding:0;}</style>
<!-- Navbar -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<nav class="main-header navbar navbar-expand <?php echo ((config('admin.theme') === 'light' || is_null(config('admin.theme'))) ? "navbar-white navbar-light" : "navbar-gray-dark navbar-dark"); ?>">
<!-- Left navbar links -->
<ul class="navbar-nav">
<li class="nav-item">
Expand All @@ -54,7 +54,7 @@
<!-- /.navbar -->

<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<aside class="main-sidebar <?php echo ((config('admin.theme') === 'light' || is_null(config('admin.theme'))) ? "sidebar-light-primary" : "sidebar-dark-primary"); ?> elevation-4">


<!-- Sidebar -->
Expand Down Expand Up @@ -335,7 +335,7 @@
</div>
<!-- ./wrapper -->
<?php } else { ?>
<body class="hold-transition login-page">
<body class="hold-transition login-page <?php echo ((config('admin.theme') === 'light' || is_null(config('admin.theme'))) ? "light-mode" : "dark-mode"); ?>">
<div class="login-box">
<div class="login-logo">
<h1><a href="https://www.htmly.com" target="_blank"><img width="200px" src="<?php echo site_url(); ?>system/resources/images/logo-big.png" alt="HTMLy"/></a></h1>
Expand Down
3 changes: 2 additions & 1 deletion system/configList.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@
"mfa.state",
"show.version",
"thumbnail.width",
"rss.description"
"rss.description",
"admin.theme"
]
21 changes: 13 additions & 8 deletions system/resources/css/adminlte.min.css

Large diffs are not rendered by default.