Skip to content
Open
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
8 changes: 3 additions & 5 deletions multipage.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ const
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Right sidebar with theme switcher and file overview -->
<!-- Right sidebar with file overview -->
<div class="right-sidebar" id="rightSidebar" style="width: 100px;">
<button class="theme-switcher" onclick="toggleTheme()">🌙 Dark</button>

<button class="$1" onclick="navigateToPage('$2')"> → Next</button>
<button class="$3" onclick="navigateToPage('$4')"> ← Prev</button>
</div>
Expand Down Expand Up @@ -95,8 +93,8 @@ proc generatePage(destDir, h1: string, content: string;
let h1content = h1.innerText()
let page = destDir / pageName(currentPage, h1content)

let n = if next.len > 0: "theme-switcher" else: "theme-switcher-disabled"
let p = if currentPage > 1: "theme-switcher" else: "theme-switcher-disabled"
let n = if next.len > 0: "nav-btn" else: "nav-btn-disabled"
let p = if currentPage > 1: "nav-btn" else: "nav-btn-disabled"

let main = mainBegin % [
n, pageName(currentPage + 1, next.innerText()),
Expand Down
8 changes: 1 addition & 7 deletions nimdoc.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,8 @@ doc.file = """<!DOCTYPE html>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Right sidebar with theme switcher and file overview -->
<!-- Right sidebar with file overview -->
<div class="right-sidebar" id="rightSidebar">
<button class="theme-switcher" onclick="toggleTheme()">🌙 Dark</button>
<div class="file-overview">
<div class="current-section" id="currentSection">Loading...</div>
</div>
Expand Down Expand Up @@ -244,11 +243,6 @@ doc.file = """<!DOCTYPE html>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Right sidebar with theme switcher and file overview -->
<div class="right-sidebar" id="rightSidebar">
<button class="theme-switcher" onclick="toggleTheme()">🌙 Dark</button>
</div>

<!-- Toggle button for sidebar (shown when collapsed) -->
<button class="sidebar-toggle" id="sidebarToggle" onclick="toggleSidebar()">📋</button>

Expand Down
34 changes: 0 additions & 34 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
// Theme switching functionality
function toggleTheme() {
const root = document.documentElement;
const button = document.querySelector('.theme-switcher');

if (root.getAttribute('data-theme') === 'dark') {
// Switch to light theme
root.removeAttribute('data-theme');
button.textContent = '🌙 Dark';
button.title = 'Switch to dark theme';
} else {
// Switch to dark theme
root.setAttribute('data-theme', 'dark');
button.textContent = '🌙 Light';
button.title = 'Switch to light theme';
}

// Save preference to localStorage
localStorage.setItem('nimony-theme', root.getAttribute('data-theme') || 'light');
}

// Sidebar toggle functionality
function toggleSidebar() {
const sidebar = document.getElementById('rightSidebar');
Expand Down Expand Up @@ -224,19 +203,6 @@ function navigateToPage(filename) {

// Load saved preferences and initialize on page load
document.addEventListener('DOMContentLoaded', function() {
// Load saved theme preference
const savedTheme = localStorage.getItem('nimony-theme');
const button = document.querySelector('.theme-switcher');

if (savedTheme === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark');
button.textContent = '🌙 Light';
button.title = 'Switch to light theme';
} else {
button.textContent = '🌙 Dark';
button.title = 'Switch to dark theme';
}

// Load saved sidebar preference
const savedSidebarCollapsed = localStorage.getItem('nimony-sidebar-collapsed');
const sidebar = document.getElementById('rightSidebar');
Expand Down
75 changes: 20 additions & 55 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,7 @@ color-scheme: light;
--clipboard-image: var(--clipboard-image-normal)
}

[data-theme="dark"] {
color-scheme: dark;
--primary-background: #171921;
--secondary-background: #1e202a;
--third-background: #2b2e3b;
--info-background: #008000;
--warning-background: #807000;
--error-background: #c03000;
--border: #0e1014;
--text: #fff;
--anchor: #8be9fd;
--anchor-focus: #8be9fd;
--input-focus: #8be9fd;
--strong: #bd93f9;
--hint: #7A7C85;

--keyword: #f8f8f2;
--identifier: #f8f8f2;
--comment: #ff79c6;
--operator: #f8f8f2;
--punctuation: #f8f8f2;
--other: #f8f8f2;
--escapeSequence: #bd93f9;
--number: #f1fa8c;
--literal: #f1fa8c;
--program: #9090c0;
--option: #90b010;
--raw-data: #8be9fd;

--clipboard-image-normal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E %3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2' /%3E %3C/svg%3E");
--clipboard-image-selected: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' viewBox='0 0 20 20' fill='currentColor'%3E %3Cpath d='M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z' /%3E %3Cpath d='M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z' /%3E %3C/svg%3E");
--clipboard-image: var(--clipboard-image-normal);
}

@media (prefers-color-scheme: dark) {
[data-theme="auto"] {
color-scheme: dark;
--primary-background: #171921;
--secondary-background: #1e202a;
Expand Down Expand Up @@ -100,8 +65,6 @@ color-scheme: dark;
--clipboard-image-selected: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' viewBox='0 0 20 20' fill='currentColor'%3E %3Cpath d='M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z' /%3E %3Cpath d='M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z' /%3E %3C/svg%3E");
--clipboard-image: var(--clipboard-image-normal);
}
}


span.DecNumber {
color: var(--number); }
Expand Down Expand Up @@ -200,20 +163,22 @@ color: var(--other); }
}

/* Dark theme color scheme */
[data-theme="dark"] {
--bg-primary: #002451; /* Dark blue background */
--bg-secondary: #00346e; /* Slightly lighter blue */
--third-background: transparent; /* Third level background */
--text-primary: #ffffff; /* White text */
--text-secondary: #ffff00; /* Yellow for captions and highlights */
--text-muted: #b4b4b4; /* Light gray for secondary text */
--border-color: #1d3f53; /* Darker blue border */
--code-bg: var(--bg-primary); /* Darker blue for code blocks */
--code-border: #1d3f53; /* Darker blue for code borders */
--accent-color: #ffff00; /* Soft red for accents */
--string-color: #d1f1a9; /* Light green for strings */
--keyword-color: #ff9da4; /* Soft red for keywords */
--comment-color: #7285b7; /* Muted blue for comments */
@media (prefers-color-scheme: dark) {
:root {
--bg-primary: #002451; /* Dark blue background */
--bg-secondary: #00346e; /* Slightly lighter blue */
--third-background: transparent; /* Third level background */
--text-primary: #ffffff; /* White text */
--text-secondary: #ffff00; /* Yellow for captions and highlights */
--text-muted: #b4b4b4; /* Light gray for secondary text */
--border-color: #1d3f53; /* Darker blue border */
--code-bg: var(--bg-primary); /* Darker blue for code blocks */
--code-border: #1d3f53; /* Darker blue for code borders */
--accent-color: #ffff00; /* Soft red for accents */
--string-color: #d1f1a9; /* Light green for strings */
--keyword-color: #ff9da4; /* Soft red for keywords */
--comment-color: #7285b7; /* Muted blue for comments */
}
}

* {
Expand Down Expand Up @@ -572,7 +537,7 @@ footer {
}

/* Theme switcher button */
.theme-switcher {
.nav-btn {
width: 100%;
background-color: var(--bg-secondary);
border: none;
Expand All @@ -588,13 +553,13 @@ footer {
text-align: center;
}

.theme-switcher:hover {
.nav-btn:hover {
background-color: var(--text-secondary);
color: var(--bg-primary);
}

/* Disabled theme switcher button */
.theme-switcher-disabled {
.nav-btn-disabled {
width: 100%;
background-color: var(--third-background);
border: none;
Expand All @@ -612,7 +577,7 @@ footer {
pointer-events: none;
}

.theme-switcher-disabled:hover {
.nav-btn-disabled:hover {
background-color: var(--third-background);
color: var(--hint);
cursor: not-allowed;
Expand Down