Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 7f166b2

Browse files
committed
docs: add more docs about Toggle Dark Mode in Grid Menu
1 parent 20426ea commit 7f166b2

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

docs/styling/dark-mode.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,35 @@ this.compositeEditorInstance?.openDetails({
6464
});
6565
```
6666

67+
### Grid Menu
68+
By default there is no command for toggling the Dark Mode from the Grid Menu, however you can show the command at any time via the following settings:
69+
70+
```ts
71+
export class MyDemo {
72+
isDarkModeEnabled = false;
73+
74+
defineGrid() {
75+
this.gridOptions = {
76+
darkMode: this.isDarkModeEnabled,
77+
gridMenu: {
78+
hideToggleDarkModeCommand: false, // hidden by default
79+
80+
// you can optionally add extra command to toggle your own page styling as well
81+
onCommand: (_, args) => {
82+
// ...
83+
},
84+
85+
// you can also change the icon and/or command name
86+
iconToggleDarkModeCommand: 'fa fa-moon-o',
87+
commandLabels: {
88+
toggleDarkModeCommand: 'Toggle Dark Mode',
89+
},
90+
}
91+
};
92+
}
93+
}
94+
```
95+
6796
### Tweaking Some Colors
6897

6998
The Dark Mode Theme was created by setting a few CSS variables, in some cases you might need to tweak some of these variables. Take a look at the Slickgrid-Universal [CSS variables](https://github.com/ghiscoding/slickgrid-universal/blob/670946dcedd330a70d2e88127a0042474e7a5348/packages/common/src/styles/_variables.scss#L976-L985) to see which variables were reassigned. Also note that if you're using other Themes like Material or Salesforce, then there's also other variables that are set (see [Material variables](https://github.com/ghiscoding/slickgrid-universal/blob/670946dcedd330a70d2e88127a0042474e7a5348/packages/common/src/styles/_variables-theme-material.scss#L159-L189) or [Salesforce variables](https://github.com/ghiscoding/slickgrid-universal/blob/670946dcedd330a70d2e88127a0042474e7a5348/packages/common/src/styles/_variables-theme-salesforce.scss#L202-L219))

src/app/examples/grid-composite-editor.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ export class GridCompositeEditorComponent implements OnDestroy, OnInit {
444444
// when using the cellMenu, you can change some of the default options and all use some of the callback methods
445445
enableCellMenu: true,
446446
gridMenu: {
447-
hideToggleDarkModeCommand: false, // disabled command by default
447+
hideToggleDarkModeCommand: false, // hidden by default
448448
onCommand: (_, args) => {
449449
if (args.command === 'toggle-dark-mode') {
450450
this._darkMode = !this._darkMode; // keep local toggle var in sync

0 commit comments

Comments
 (0)