Skip to content

dphiffer/everyhexcolor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

everyhexcolor

A bot that tweets out random hex colors.

Popular colors

You can browse 255 popular colors according to Twitter faves/retweets. (Currently reflects a snapshot of pre-October 2017 tweets, due to Twitter's API and bot shenanigans.)

Tracery source

Runs on Cheap Bots, Done Quick! and Cheap Boots, Toot Sweet! in Tracery format.

{
	"origin": "#[hex:#color#]hexcolor#",
	"hexcolor": "\\##hex# {img https://phiffer.org/everyhexcolor/img.php?hex=#hex#}",
	"color": "#channel##channel##channel#",
	"channel": "#digit##digit#",
	"digit": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]
}

PHP image generator

The PNG image that accompanies each hex color toot/tweet is generated by a script that uses PHP's GD module.

<?php

function generate_image($hex) {
	$im = imagecreatetruecolor(527, 262);
	list($r, $g, $b) = sscanf($hex, "%02x%02x%02x");
	if (($r + $g + $b) > 382) {
		$tr = max(0, $r - 50);
		$tg = max(0, $g - 50);
		$tb = max(0, $b - 50);
	} else {
		$tr = min(255, $r + 50);
		$tg = min(255, $g + 50);
		$tb = min(255, $b + 50);
	}
	$bg_color = imagecolorallocate($im, $r, $g, $b);
	$text_color = imagecolorallocate($im, $tr, $tg, $tb);
	imagefill ($im, 0, 0, $bg_color);
	imagettftext($im, 24, 0, 186, 142, $text_color, __DIR__ . '/vera_sans/Vera.ttf', strtoupper("#$hex"));
	imagepng($im);
}

Thanks to

About

🌈 A Twitter bot that tweets every hex color

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published