Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
colo_js_ojisan
Search
Yosuke Furukawa
PRO
September 16, 2014
Programming
0
1.7k
colo_js_ojisan
JSオジサンの発表資料 colo についての話
Yosuke Furukawa
PRO
September 16, 2014
Tweet
Share
More Decks by Yosuke Furukawa
See All by Yosuke Furukawa
デザインシステムが必須の時代に
yosuke_furukawa
PRO
2
170
Node.js, Deno, Bun 最新動向とその所感について
yosuke_furukawa
PRO
10
4.6k
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
1
4.4k
tc39 x jsconf.jp Panel Discussion 2024
yosuke_furukawa
PRO
0
280
Removing Corepack
yosuke_furukawa
PRO
9
1.7k
JavaScript Runtime とはなにか
yosuke_furukawa
PRO
15
2.9k
Strip Types と Storage
yosuke_furukawa
PRO
4
450
Module Harmony について
yosuke_furukawa
PRO
3
1.8k
LTのやり方
yosuke_furukawa
PRO
16
2.8k
Other Decks in Programming
See All in Programming
ID管理機能開発の裏側 高速にSaaS連携を実現したチームのAI活用編
atzzcokek
0
120
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 1
philipschwarz
PRO
0
110
モダンJSフレームワークのビルドプロセス 〜なぜReactは503行、Svelteは12行なのか〜
fuuki12
0
150
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
4
220
JEP 496 と JEP 497 から学ぶ耐量子計算機暗号入門 / Learning Post-Quantum Crypto Basics from JEP 496 & 497
mackey0225
2
510
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
170
How Software Deployment tools have changed in the past 20 years
geshan
0
25k
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
280
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
1
190
競馬で学ぶ機械学習の基本と実践 / Machine Learning with Horse Racing
shoheimitani
14
14k
jakarta-security-jjug-ccc-2025-fall
tnagao7
0
100
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
10
9.5k
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
2.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Designing Experiences People Love
moore
142
24k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
The Cult of Friendly URLs
andyhume
79
6.7k
Statistics for Hackers
jakevdp
799
230k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Bash Introduction
62gerente
615
210k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Making Projects Easy
brettharned
120
6.5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
Transcript
colo @yosuke_furukawa
Twitter: @yosuke_furukawa Github: yosuke-furukawa Real Name: Yosuke Furukawa
Node.jsຊϢʔβʔάϧʔϓද
console.log(“hoge”) ͯ͠·͔͢?
console.log(“hoge”) ʹ৭Λ͚Δํ๏ͬͯ·͔͢?
node.jsͰ?
Node.jsͰͷํ๏ //ίϯιʔϧ͘͢Δɿ console.log('\033[31m' + 'Hello World'+ '\033[39m'); ! //ίϯιʔϧԫ৭͘͢Δɿ console.log('\033[33m'+
'Hello World'+ '\033[39m'); ! //ίϯιʔϧ੨৭ʹ͢Δɿ console.log('\033[36m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧփ৭ʹ͢Δɿ console.log('\033[90m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧ৭ʹ͢Δɿ console.log('\033[32m ' + 'Hello World'+ ' \033[39m');
browserͰ?
browserͰͷํ๏ //ίϯιʔϧ͘͢Δɿ console.log(‘%cHello World’, ‘color : red;’); ! //ίϯιʔϧԫ৭͘͢Δɿ console.log(‘%cHello
World’, ‘color : yellow;’); ! //ίϯιʔϧ੨৭ʹ͢Δɿ console.log(‘%cHello World’, ‘color : blue;’); ! //ίϯιʔϧփ৭ʹ͢Δɿ console.log(‘%cHello World’, ‘color : grey;’); ! //ίϯιʔϧ৭ʹ͢Δɿ console.log(‘%cHello World’, ‘color : green;’);
Node.jsͰͷํ๏
͜ͷํ๏ͷ
Node.jsͰͷํ๏ //ίϯιʔϧ͘͢Δɿ console.log('\033[31m' + 'Hello World'+ '\033[39m'); ! //ίϯιʔϧԫ৭͘͢Δɿ console.log('\033[33m'+
'Hello World'+ '\033[39m'); ! //ίϯιʔϧ੨৭ʹ͢Δɿ console.log('\033[36m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧփ৭ʹ͢Δɿ console.log('\033[90m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧ৭ʹ͢Δɿ console.log('\033[32m ' + 'Hello World'+ ' \033[39m');
Node.jsͰͷํ๏ //ίϯιʔϧ͘͢Δɿ console.log('\033[31m' + 'Hello World'+ '\033[39m'); ! //ίϯιʔϧԫ৭͘͢Δɿ console.log('\033[33m'+
'Hello World'+ '\033[39m'); ! //ίϯιʔϧ੨৭ʹ͢Δɿ console.log('\033[36m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧփ৭ʹ͢Δɿ console.log('\033[90m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧ৭ʹ͢Δɿ console.log('\033[32m ' + 'Hello World'+ ' \033[39m'); ֮͑ΒΕͳ͍ɻ
Node.jsͰͷํ๏ //ίϯιʔϧ͘͢Δɿ console.log('\033[31m' + 'Hello World'+ '\033[39m'); ! //ίϯιʔϧԫ৭͘͢Δɿ console.log('\033[33m'+
'Hello World'+ '\033[39m'); ! //ίϯιʔϧ੨৭ʹ͢Δɿ console.log('\033[36m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧփ৭ʹ͢Δɿ console.log('\033[90m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧ৭ʹ͢Δɿ console.log('\033[32m ' + 'Hello World'+ ' \033[39m');
Node.jsͰͷํ๏ //ίϯιʔϧ͘͢Δɿ console.log('\033[31m' + 'Hello World'+ '\033[39m'); ! //ίϯιʔϧԫ৭͘͢Δɿ console.log('\033[33m'+
'Hello World'+ '\033[39m'); ! //ίϯιʔϧ੨৭ʹ͢Δɿ console.log('\033[36m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧփ৭ʹ͢Δɿ console.log('\033[90m' + 'Hello World' + '\033[39m'); ! //ίϯιʔϧ৭ʹ͢Δɿ console.log('\033[32m ' + 'Hello World'+ ' \033[39m'); a͕`VTFTUSJDU` ҎԼͰౖΒΕΔ
ଞͷcolorizeϞδϡʔϧ
colors Stringͷprototype ֦ுͯ͠͠·͏ɻ //ίϯιʔϧ͘͢Δɿ console.log('Hello World’.red);
colorize ಠࣗߏจΛ֮͑Δඞཁ͕͋Δ //ίϯιʔϧ͘͢Δɿ console.log(colorize.ansify(“#red[Hello World]”));
ansi-color-stream શͯStreamͷsubstackۘ //ίϯιʔϧ͘͢Δɿ a.pipe(colorize(“red”)).pipe(process.stdout);
chalk Ұ൪͍͚ͯΔ͚Ͳ ػೳ͕ଟͯ͘ɺґଘ͕ଟ͍ (browserαϙʔτͯ͠ͳ͍) //ίϯιʔϧ͘͢Δɿ console.log(chalk.red(“Hello World”));
chalk Ұ൪͍͚ͯΔ͚Ͳ ػೳ͕ଟͯ͘ɺґଘ͕ଟ͍ //ίϯιʔϧ͘͢Δɿ console.log(chalk.red(“Hello World”)); ͭ·Γɺ͋Μ·Γ ͍͚ͯΔͷ͕ͳ͍
colo
code examples
coloͰͷํ๏ //ίϯιʔϧ͘͢Δɿ console.log(colo.red(‘colo colo’)); ! //ίϯιʔϧΛcyan + boldʹ͢Δɿ console.log(colo.cyan.bold(‘colo colo’));
! //ίϯιʔϧΛgreen + underlineʹ͢Δɿ console.log(colo.green.underline(‘colo colo’)); ! //ίϯιʔϧΛmagenta + italicʹ͢Δɿ console.log(colo.magenta.italic(‘colo colo’)); ! //ίϯιʔϧΛgrey + inverseʹ͢Δɿ console.log(colo.grey.inverse(‘colo colo’));
coloͰͷํ๏ //ίϯιʔϧ͘͢Δɿ console.log(colo.red(‘colo colo’)); ! //ίϯιʔϧΛcyan + boldʹ͢Δɿ console.log(colo.cyan.bold(‘colo colo’));
! //ίϯιʔϧΛgreen + underlineʹ͢Δɿ console.log(colo.green.underline(‘colo colo’)); ! //ίϯιʔϧΛmagenta + italicʹ͢Δɿ console.log(colo.magenta.italic(‘colo colo’)); ! //ίϯιʔϧΛgrey + inverseʹ͢Δɿ console.log(colo.grey.inverse(‘colo colo’));
DSL like!
colo DSL colo.red("RED"); colo.red.bold("RED and BOLD"); colo.red.bold.underline("RED and BOLD and
UNDERLINE”);
colo DSL colo.red("RED"); colo.red.bold("RED and BOLD"); colo.red.bold.underline("RED and BOLD and
UNDERLINE”);
colo DSL colo.red("RED"); colo.red.bold("RED and BOLD"); colo.red.bold.underline("RED and BOLD and
UNDERLINE”); QSPQFSUZΞΫηεͬΆ͘ ॏͶ͕͚Ͱ͖Δɻ
Browser support! (Chrome, SafariͷΈ)
colo supports browser // DEMO colog(colo.red(“colo colo")); colog(colo.cyan.bold("colo colo")); colog(colo.green.underline("colo
colo")); colog(colo.magenta.italic.bold("colo colo")); colog(colo.grey.bold.italic.underline("colo colo")); #SPXTFSͰDPMPHΛͬͯ දࣔͰ͖Δɻ
DEMO
colo inside
colo inside Object.definePropertiesͷωετ __proto__Λͬͯಈతʹprototype chainΛ࣮ݱ ґଘϞδϡʔϧθϩͰ࣮ݱ
colo code (github) https://github.com/yosuke-furukawa/colo