github.com/oam-dev/kubevela@v1.9.11/references/cli/top/component/logo.go (about) 1 /* 2 Copyright 2022 The KubeVela Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package component 18 19 import ( 20 "fmt" 21 22 "github.com/rivo/tview" 23 24 "github.com/oam-dev/kubevela/references/cli/top/config" 25 ) 26 27 var velaLogo = []string{ 28 ` _ __ _ __ __ _ `, 29 `| |/ /_ _ | |__ ___\ \ / /___ | | __ _ `, 30 `| ' /| | | || '_ \ / _ \\ \ / // _ \| | / _\ |`, 31 `| . \| |_| || |_) || __/ \ V /| __/| || (_| |`, 32 `|_|\_\\__,_||_.__/ \___| \_/ \___||_| \__,_|`, 33 } 34 35 // Logo logo component in header 36 type Logo struct { 37 *tview.TextView 38 style *config.ThemeConfig 39 } 40 41 // NewLogo return logo ui component 42 func NewLogo(config *config.ThemeConfig) *Logo { 43 l := &Logo{ 44 TextView: tview.NewTextView(), 45 style: config, 46 } 47 l.init() 48 return l 49 } 50 51 func (l *Logo) init() { 52 l.SetWrap(false) 53 l.SetWordWrap(false) 54 l.SetTextAlign(tview.AlignCenter) 55 l.SetTextColor(l.style.Logo.Text.Color()) 56 l.SetDynamicColors(true) 57 for _, line := range velaLogo { 58 fmt.Fprintf(l, "%s\n", line) 59 } 60 }