Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Using RGBA Colour The Bagpuss Way
Search
Drew McLellan
September 27, 2011
Technology
110
1
Share
Using RGBA Colour The Bagpuss Way
From Oxford Geek Night.
Drew McLellan
September 27, 2011
More Decks by Drew McLellan
See All by Drew McLellan
HTML5 APIs PHP Yorkshire 2017
drewm
1
210
HTML5 APIs Confoo Montreal
drewm
1
280
PHP Payments with Omnipay
drewm
0
130
HTML5 APIs Confoo Vancouver
drewm
0
300
Learn to Love Regular Expressions
drewm
0
170
Ecommerce Projects with Moltin
drewm
0
700
Writing Portable PHP
drewm
0
140
Getting to Grips with Regular Expressions
drewm
1
280
Back to Front Performance - Oct 2013
drewm
0
130
Other Decks in Technology
See All in Technology
AI とサービス・デザイン / AI and Service Design
ks91
PRO
0
170
AIのために、AIを使った、Effect-TSからの脱却 〜テストを活用した安全なリファクタリングの進め方〜
bitkey
PRO
1
550
エムスリーテクノロジーズ株式会社 エンジニア向け紹介資料 / M3 Technologies Company Deck
m3_engineering
0
230
Copilot CLI・IDE・Web・スマホで途切れない開発フローを目指して / One Copilot flow - CLI IDE Web Mobile
aeonpeople
1
980
freee-mcpを Local→Remote で出してわかった MCP認可実装のリアル
terara
3
620
権限管理設計を完全に理解した
rsugi
1
200
基礎から解説!Icebergで紐解くSnowflake×Databricks連携の現在地
cm_yasuhara
0
270
Loadbalancing exporter internals
ymotongpoo
1
130
ジュニアエンジニアはSREとどう向き合うべきか
nrinetcom
PRO
1
120
AI時代の私の技術インプットとアウトプット術
tonkotsuboy_com
3
620
「使われるデータ基盤」を目指してデータアナリストとワークショップをやった話
jackojacko_
2
850
AI駆動開発でなんでもハンズオン環境をつくってみた
yoshimi0227
0
120
Featured
See All Featured
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
360
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
240
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
150
Raft: Consensus for Rubyists
vanstee
141
7.4k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
190
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
220
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
65
54k
Thoughts on Productivity
jonyablonski
76
5.2k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
54k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
380
Transcript
Using RGBA Colour The Bagpuss Way Oxford Geek Night 10
- 21 January 2009 Drew McLellan, edgeofmyseat.com
There are lots of different ways to specify colours in
CSS
fuchsia #FF00FF #F0F rgb(255, 0, 255) rgb(100%, 0, 100%)
However you write it, they’re identical colours. (it’s all the
same biscuit)
They all have one other important aspect in common.
These all specify solid colours.
CSS3 introduces rgba()
Red Green Blue Alpha (opacity)
rgba(255, 255, 255, 0.5)
rgba(255, 255, 255, 0.5)
But that’s what CSS3 opacity does isn’t it?
filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5;
Opacity affects the entire object Hello world Hello world
RGBA is about the opacity of a colour Hello world
Hello world Hello world
Pink stripes 100% opacity
Entire Bagpuss 50% opacity
Pink stripes 50% opacity, as nature intended
Closer to a tiled, flat colour semi-transparent PNG, without the
image.
... but also works for text, borders, foregrounds, backgrounds, playgrounds.
(maybe not playgrounds)
How?
rgba(255, 255, 255, 0.5)
Browser support is ok, but not great.
Firefox 3 Safari 3 Opera 10
So how can we use this today without ending up
with a nasty old mess in rubbish old browsers that don’t support all this lovely RGBA stuff?
None
Fall back to solid colour background: rgb(187, 192, 187); background:
rgba(120, 130, 120, 0.5);
Fall back to alpha PNG background: transparent url(green50.png); background: rgba(120,
130, 120, 0.5) none;
Tell me more! http://allinthehead.com/code/rgba/ http://dorward.me.uk/www/css/alpha-colour/
allinthehead.com/presentations Thank you. twitter.com/drewm