Skip to content

Commit 6898e3a

Browse files
committed
Add color property to folder icons in DOMService for improved styling
1 parent fd0bfff commit 6898e3a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

example.index.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
{
1515
"title": "Unreal Engine",
1616
"type": "folder",
17+
"color": "#2196f3",
1718
"path": "docs/unreal-engine.md",
1819
"slug": "unreal-engine",
1920
"items": [

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,10 @@ class DOMService {
197197
}
198198

199199
createFolderHeaderWithFile(iconClass, doc) {
200+
const iconStyle = doc.color ? `color: ${doc.color};` : '';
200201
return `
201202
<div class="folder-icons">
202-
<i class="${iconClass} folder-icon"></i>
203+
<i class="${iconClass} folder-icon" style="${iconStyle}"></i>
203204
</div>
204205
<span>${doc.title}</span>
205206
<a href="?${doc.slug}" class="folder-link" title="View folder page">
@@ -208,9 +209,10 @@ class DOMService {
208209
}
209210

210211
createFolderHeaderBasic(iconClass, doc) {
212+
const iconStyle = doc.color ? `color: ${doc.color};` : '';
211213
return `
212214
<div class="folder-icons">
213-
<i class="${iconClass} folder-icon"></i>
215+
<i class="${iconClass} folder-icon" style="${iconStyle}"></i>
214216
</div>
215217
<span>${doc.title}</span>`;
216218
}

0 commit comments

Comments
 (0)