Skip to content

Commit

Permalink
Added background option
Browse files Browse the repository at this point in the history
Allows the user to configure whether the theme's background color is displayed
  • Loading branch information
OpenSauce04 committed Nov 4, 2024
1 parent c8eeb78 commit c6e888a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions data/micro.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"type": "boolean",
"default": false
},
"background": {
"description": "Whether to display the theme's background color\nhttps://github.com/zyedidia/micro/blob/master/runtime/help/options.md#options",
"type": "boolean",
"default": false
},
"backup": {
"description": "Whether to backup all open buffers\nhttps://github.com/zyedidia/micro/blob/master/runtime/help/options.md#options",
"type": "boolean",
Expand Down
2 changes: 1 addition & 1 deletion internal/action/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func doSetGlobalOptionNative(option string, nativeValue interface{}) error {
config.ModifiedSettings[option] = true
delete(config.VolatileSettings, option)

if option == "colorscheme" {
if option == "colorscheme" || option == "background" {
// LoadSyntaxFiles()
config.InitColorscheme()
for _, b := range buffer.OpenBuffers {
Expand Down
5 changes: 5 additions & 0 deletions internal/config/colorscheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ lineLoop:
colors := string(matches[2])

style := StringToStyle(colors)

if !GlobalSettings["background"].(bool) && link != "statusline" {
style = style.Background(tcell.ColorDefault)
}

c[link] = style

if link == "default" {
Expand Down
1 change: 1 addition & 0 deletions internal/config/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var OptionChoices = map[string][]string{
var defaultCommonSettings = map[string]interface{}{
"autoindent": true,
"autosu": false,
"background": true,
"backup": true,
"backupdir": "",
"basename": false,
Expand Down
6 changes: 6 additions & 0 deletions runtime/help/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ Here are the available options:

default value: `false`

* `background`: Whether to display the current theme's background color.
If this option is disabled, the background color of the current theme
will not be used and instead the terminal's default color will be shown.

default value: `true`

* `backup`: micro will automatically keep backups of all open buffers. Backups
are stored in `~/.config/micro/backups` and are removed when the buffer is
closed cleanly. In the case of a system crash or a micro crash, the contents
Expand Down

0 comments on commit c6e888a

Please sign in to comment.