v / examples / term_display_sixel.v
24 lines · 22 sloc · 701 bytes · 47e93d1c3978ace0b8ea65b035fe0bbde87d60cc
Raw
1module main
2
3import os
4import term
5
6fn main() {
7 println('If your terminal supports the sixel graphics format,')
8 println('you should see a small green "HI" and a V logo below this text.\n')
9 if term.supports_sixel() {
10 // Prints the original "HI" sixel image from the spec:
11 // https://www.digiater.nl/openvms/decus/vax90b1/krypton-nasa/all-about-sixels.text (See "V. EXAMPLE SIXEL IMAGE" section)
12 println('\ePq
13#0;2;0;0;0#1;2;100;100;0#2;2;0;100;0
14#1~~@@vv@@~~@@~~$
15#2??}}GG}}??}}??-
16#1!14@
17\e\\')
18 // Prints a 128x128 pixels V logo
19 bytes := os.read_bytes(os.resource_abs_path('assets/v.six'))!
20 println(bytes.bytestr())
21 dump(term.supports_sixel())
22 dump(term.graphics_num_colors())
23 }
24}
25