当前位置: 首页>>代码示例>>Golang>>正文


Golang C.COLOR_PAIR函数代码示例

本文整理汇总了Golang中C.COLOR_PAIR函数的典型用法代码示例。如果您正苦于以下问题:Golang COLOR_PAIR函数的具体用法?Golang COLOR_PAIR怎么用?Golang COLOR_PAIR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了COLOR_PAIR函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: attrColored

func attrColored(pair int, a Attr) C.int {
	var attr C.int
	if pair > ColNormal {
		attr = C.COLOR_PAIR(C.int(pair))
	}
	return attr | C.int(a)
}
开发者ID:infokiller,项目名称:fzf,代码行数:7,代码来源:curses.go

示例2: attrColored

func attrColored(pair int, bold bool) C.int {
	var attr C.int
	if pair > ColNormal {
		attr = C.COLOR_PAIR(C.int(pair))
	}
	if bold {
		attr = attr | C.A_BOLD
	}
	return attr
}
开发者ID:zennro,项目名称:fzf,代码行数:10,代码来源:curses.go

示例3: Init

func Init(theme *ColorTheme, black bool, mouse bool) {
	C.setlocale(C.LC_ALL, C.CString(""))
	tty := C.c_tty()
	if tty == nil {
		fmt.Println("Failed to open /dev/tty")
		os.Exit(2)
	}
	_screen = C.c_newterm(tty)
	if _screen == nil {
		fmt.Println("Invalid $TERM: " + os.Getenv("TERM"))
		os.Exit(2)
	}
	C.set_term(_screen)
	if mouse {
		C.mousemask(C.ALL_MOUSE_EVENTS, nil)
		C.mouseinterval(0)
	}
	C.noecho()
	C.raw() // stty dsusp undef
	C.nonl()
	C.keypad(C.stdscr, true)

	delay := 50
	delayEnv := os.Getenv("ESCDELAY")
	if len(delayEnv) > 0 {
		num, err := strconv.Atoi(delayEnv)
		if err == nil && num >= 0 {
			delay = num
		}
	}
	C.set_escdelay(C.int(delay))

	_color = theme != nil
	if _color {
		C.start_color()
		InitTheme(theme, black)
		initPairs(theme)
		C.bkgd(C.chtype(C.COLOR_PAIR(C.int(ColNormal))))
		_colorFn = attrColored
	} else {
		_colorFn = attrMono
	}

	C.nodelay(C.stdscr, true)
	ch := C.getch()
	if ch != C.ERR {
		C.ungetch(ch)
	}
	C.nodelay(C.stdscr, false)
}
开发者ID:robertmeta,项目名称:vimfiles,代码行数:50,代码来源:ncurses.go

示例4: Init

func (r *FullscreenRenderer) Init() {
	C.setlocale(C.LC_ALL, C.CString(""))
	tty := C.c_tty()
	if tty == nil {
		errorExit("Failed to open /dev/tty")
	}
	_screen = C.c_newterm(tty)
	if _screen == nil {
		errorExit("Invalid $TERM: " + os.Getenv("TERM"))
	}
	C.set_term(_screen)
	if r.mouse {
		C.mousemask(C.ALL_MOUSE_EVENTS, nil)
		C.mouseinterval(0)
	}
	C.noecho()
	C.raw() // stty dsusp undef
	C.nonl()
	C.keypad(C.stdscr, true)

	delay := 50
	delayEnv := os.Getenv("ESCDELAY")
	if len(delayEnv) > 0 {
		num, err := strconv.Atoi(delayEnv)
		if err == nil && num >= 0 {
			delay = num
		}
	}
	C.set_escdelay(C.int(delay))

	if r.theme != nil {
		C.start_color()
		initTheme(r.theme, r.defaultTheme(), r.forceBlack)
		initPairs(r.theme)
		C.bkgd(C.chtype(C.COLOR_PAIR(C.int(ColNormal.index()))))
		_colorFn = attrColored
	} else {
		initTheme(r.theme, nil, r.forceBlack)
		_colorFn = attrMono
	}

	C.nodelay(C.stdscr, true)
	ch := C.getch()
	if ch != C.ERR {
		C.ungetch(ch)
	}
	C.nodelay(C.stdscr, false)
}
开发者ID:junegunn,项目名称:fzf,代码行数:48,代码来源:ncurses.go

示例5: NewWindow

func (r *FullscreenRenderer) NewWindow(top int, left int, width int, height int, border bool) Window {
	win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
	if r.theme != nil {
		C.wbkgd(win, C.chtype(C.COLOR_PAIR(C.int(ColNormal.index()))))
	}
	if border {
		pair, attr := _colorFn(ColBorder, 0)
		C.wcolor_set(win, pair, nil)
		C.wattron(win, attr)
		C.box(win, 0, 0)
		C.wattroff(win, attr)
		C.wcolor_set(win, 0, nil)
	}

	return &CursesWindow{
		impl:   win,
		top:    top,
		left:   left,
		width:  width,
		height: height,
	}
}
开发者ID:junegunn,项目名称:fzf,代码行数:22,代码来源:ncurses.go

示例6: NewWindow

func NewWindow(top int, left int, width int, height int, border bool) *Window {
	win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
	if _color {
		C.wbkgd(win, C.chtype(C.COLOR_PAIR(C.int(ColNormal))))
	}
	if border {
		pair, attr := _colorFn(ColBorder, 0)
		C.wcolor_set(win, pair, nil)
		C.wattron(win, attr)
		C.box(win, 0, 0)
		C.wattroff(win, attr)
		C.wcolor_set(win, 0, nil)
	}

	return &Window{
		impl:   (*WindowImpl)(win),
		Top:    top,
		Left:   left,
		Width:  width,
		Height: height,
	}
}
开发者ID:robertmeta,项目名称:vimfiles,代码行数:22,代码来源:ncurses.go

示例7: ColorPair

func ColorPair(pairID int) int32 {
	return int32(C.COLOR_PAIR(C.int(pairID)))
}
开发者ID:jncorpron,项目名称:gocurse,代码行数:3,代码来源:curses.go

示例8: Color_pair

func Color_pair(pair int) int32 {
	return int32(C.COLOR_PAIR(C.int(pair)))
}
开发者ID:AaronO,项目名称:lightwave,代码行数:3,代码来源:curses.go

示例9: GetColorPair

func GetColorPair(pair int) int32 {
	return int32(C.COLOR_PAIR(C.int(pair)))
}
开发者ID:zozor,项目名称:gocurse,代码行数:3,代码来源:curses.go

示例10: ColorPair

/* Gets a ColorPair for use in the Attr functions */
func ColorPair(n int) int {
	return int(C.COLOR_PAIR(C.int(n)))
}
开发者ID:Olreich,项目名称:ncurses,代码行数:4,代码来源:ncurses.go

示例11: Color_pair

func Color_pair(pair int) int32 {
	in()
	defer out()
	return int32(C.COLOR_PAIR(C.int(pair)))
}
开发者ID:serraavenger,项目名称:gocurses,代码行数:5,代码来源:curses.go


注:本文中的C.COLOR_PAIR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。