Documentation ¶
Overview ¶
Package config initializes all files required for Amfora, even those used by other packages. It also reads in the config file and initializes a Viper and the theme
Index ¶
- Constants
- Variables
- func GetColor(key string) tcell.Color
- func GetColorString(key string) string
- func GetContrastingColor(color tcell.Color) tcell.Color
- func GetKeyBinding(cmd Command) string
- func GetTextColor(key, bg string) tcell.Color
- func GetTextColorString(key, bg string) string
- func Init() error
- func KeyInit()
- func SetColor(key string, color tcell.Color)
- type Command
- type MediaHandler
Constants ¶
const ( CmdInvalid Command = 0 CmdLink1 = 1 CmdLink2 = 2 CmdLink3 = 3 CmdLink4 = 4 CmdLink5 = 5 CmdLink6 = 6 CmdLink7 = 7 CmdLink8 = 8 CmdLink9 = 9 CmdLink0 = 10 CmdTab1 = 11 CmdTab2 = 12 CmdTab3 = 13 CmdTab4 = 14 CmdTab5 = 15 CmdTab6 = 16 CmdTab7 = 17 CmdTab8 = 18 CmdTab9 = 19 CmdTab0 = 20 CmdBottom = iota CmdEdit CmdHome CmdBookmarks CmdAddBookmark CmdSave CmdReload CmdBack CmdForward CmdMoveUp CmdMoveDown CmdMoveLeft CmdMoveRight CmdPgup CmdPgdn CmdNewTab CmdCloseTab CmdNextTab CmdPrevTab CmdQuit CmdHelp CmdSub CmdAddSub CmdCopyPageURL CmdCopyTargetURL CmdBeginning CmdEnd CmdURLHandlerOpen // See #143 )
const ColorBg = tcell.ColorSpecial | 3
The same as ColorFg, but inverted
const ColorFg = tcell.ColorSpecial | 2
Special color with no real color value Used for a default foreground color White is the terminal background is black, black if the terminal background is white Converted to a real color in this file before being sent out to other modules
Variables ¶
var BkmkPath string // New XBEL (XML) bookmarks file, see #68
var BkmkStore = viper.New() // TOML API for old bookmarks file
Bookmarks
var ColorToColorName = map[tcell.Color]string{}/* 139 elements not displayed */
Inverted version of a tcell map https://github.com/gdamore/tcell/blob/v2.3.3/color.go#L845
var CustomNewTab bool
var DownloadsDir string
var HTTPCommand []string
Command for opening HTTP(S) URLs in the browser, from "a-general.http" in config.
var MediaHandlers = make(map[string]MediaHandler)
var NewTabPath string
var OldBkmkPath string // Old bookmarks file that used TOML format
var ScrollBar cview.ScrollBarVisibility
Controlled by "a-general.scrollbar" in config Defaults to ScrollBarAuto on an invalid value
var SubscriptionPath string
var TempDownloadsDir string
var TofuStore = viper.New()
Functions ¶
func GetColor ¶
func GetColor(key string) tcell.Color
GetColor will return tcell.ColorBlack if there is no tcell.Color for the provided key.
func GetColorString ¶
GetColorString returns a string that can be used in a cview tcell.Color tag, for the given theme key. It will return "#000000" if there is no tcell.Color for the provided key.
func GetContrastingColor ¶
func GetContrastingColor(color tcell.Color) tcell.Color
GetContrastingColor returns tcell.ColorBlack if tcell.Color is brighter than gray otherwise returns tcell.ColorWhite if tcell.Color is dimmer than gray if tcell.Color is tcell.ColorDefault (undefined luminance) this returns tcell.ColorDefault
func GetKeyBinding ¶
Get all keybindings for a Command as a string. Used by the help panel so bindable keys display with their bound values rather than hardcoded defaults.
func GetTextColor ¶
func GetTextColor(key, bg string) tcell.Color
GetTextColor is the Same as GetColor, unless the key is "default". This happens on focus of a UI element which has a bg of default, in which case It return tcell.ColorBlack or tcell.ColorWhite, depending on which is more readable
func GetTextColorString ¶
GetTextColorString is the Same as GetColorString, unless the key is "default". This happens on focus of a UI element which has a bg of default, in which case It return tcell.ColorBlack or tcell.ColorWhite, depending on which is more readable
Types ¶
type Command ¶
type Command int
NOTE: CmdLink[1-90] and CmdTab[1-90] need to be in-order and consecutive This property is used to simplify key handling in display/display.go
func TranslateKeyEvent ¶
func TranslateKeyEvent(e *tcell.EventKey) Command
Used by the display package to turn a tcell.EventKey into a Command