awesome-gocui / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
350 stars 39 forks source link

Add frame customization #72

Closed dankox closed 3 years ago

dankox commented 4 years ago

This PR adds View.Frame customization.

View.FrameColor can be specified to change default color of the frame. View.TitleColor can be specified to change default color for View.Title and View.Subtitle These colors are used only if Gui.Highlight=false or if the customized view is not current.

To maintain backward compatibility, if any of these color is not set (or set to ColorDefault which is 0) original colors are used.

View.FrameRunes slice can be specified for View allowing to change frame style. The slice length determine how many customized runes will be used and the rest would be filled from the defaults (kinda, this applies from length > 6). I added there cornerCustomRune() function which is used to translate indexes for cornerRune() into indexes for View.FrameRunes.

There is also _examples/custom_frame.go example, which is customized form of _examples/active.go example. It has 4 different views with 4 different setups to demonstrate the customization available and also to show the Gui.SupportOverlay option functionality.

Fixes #71 .

glvr182 commented 4 years ago

Had finals this week so didnt have time to check, will look at it tomorrow

phanirithvij commented 3 years ago

@glvr182 pinging so this can be merged.

mjarkk commented 3 years ago

Oh yes of course lets do that!