Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
Termbox Go
提交
05c88273
T
Termbox Go
项目概览
btwise
/
Termbox Go
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Termbox Go
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
05c88273
编写于
10月 06, 2015
作者:
P
Pavlov Eugene
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
expand grayscale
上级
9914d1c5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
11 deletion
+19
-11
api.go
api.go
+9
-7
termbox.go
termbox.go
+10
-4
未找到文件。
api.go
浏览文件 @
05c88273
...
...
@@ -397,6 +397,7 @@ func SetInputMode(mode InputMode) InputMode {
}
// Sets the termbox output mode. Termbox has four output options:
//
// 1. OutputNormal => [1..8]
// This mode provides 8 different colors:
// black, red, green, yellow, blue, magenta, cyan, white
...
...
@@ -408,10 +409,10 @@ func SetInputMode(mode InputMode) InputMode {
//
// 2. Output256 => [1..256]
// In this mode you can leverage the 256 terminal mode:
// 0x0
0 - 0x07
: the 8 colors as in OutputNormal
// 0x0
8 - 0x0f
: Color* | AttrBold
// 0x1
0 - 0xe7
: 216 different colors
// 0xe
8 - 0x
ff: 24 different shades of grey
// 0x0
1 - 0x08
: the 8 colors as in OutputNormal
// 0x0
9 - 0x10
: Color* | AttrBold
// 0x1
1 - 0xe8
: 216 different colors
// 0xe
9 - 0x1
ff: 24 different shades of grey
//
// Example usage:
// SetCell(x, y, '@', 184, 240);
...
...
@@ -421,11 +422,12 @@ func SetInputMode(mode InputMode) InputMode {
// This mode supports the 3rd range of the 256 mode only.
// But you dont need to provide an offset.
//
// 4. OutputGrayscale => [1..24]
// This mode supports the 4th range of the 256 mode only.
// 4. OutputGrayscale => [1..26]
// This mode supports the 4th range of the 256 mode
// and black and white colors from 3th range of the 256 mode
// But you dont need to provide an offset.
//
// In all modes, 0 represents the default color.
// In all modes, 0
x00
represents the default color.
//
// `go run _demos/output.go` to see its impact on your terminal.
//
...
...
termbox.go
浏览文件 @
05c88273
...
...
@@ -72,6 +72,12 @@ var (
input_comm
=
make
(
chan
input_event
)
interrupt_comm
=
make
(
chan
struct
{})
intbuf
=
make
([]
byte
,
0
,
16
)
// grayscale indexes
grayscale
=
[]
Attribute
{
0
,
17
,
233
,
234
,
235
,
236
,
237
,
238
,
239
,
240
,
241
,
242
,
243
,
244
,
245
,
246
,
247
,
248
,
249
,
250
,
251
,
252
,
253
,
254
,
255
,
256
,
232
,
}
)
func
write_cursor
(
x
,
y
int
)
{
...
...
@@ -171,17 +177,17 @@ func send_attr(fg, bg Attribute) {
case
OutputGrayscale
:
fgcol
=
fg
&
0x1F
bgcol
=
bg
&
0x1F
if
fgcol
>
2
4
{
if
fgcol
>
2
6
{
fgcol
=
ColorDefault
}
if
bgcol
>
2
4
{
if
bgcol
>
2
6
{
bgcol
=
ColorDefault
}
if
fgcol
!=
ColorDefault
{
fgcol
+=
0xe8
fgcol
=
grayscale
[
fgcol
]
}
if
bgcol
!=
ColorDefault
{
bgcol
+=
0xe8
bgcol
=
grayscale
[
bgcol
]
}
default
:
fgcol
=
fg
&
0x0F
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录