NES-gamepad built with css3. No images. No javascript apart from the d-pad (which is a canvas). Test it here. Try pressing the buttons.
Supported in modern webkit or gecko-based browsers and IE9+
Section "InputClass" | |
Identifier "touchpad catchall" | |
Driver "synaptics" | |
MatchIsTouchpad "on" | |
Option "TapButton1" "1" # Left click on tap | |
Option "TapButton2" "3" # Right click on two finger tap | |
Option "MinSpeed" "1" | |
Option "MaxSpeed" "1.8" | |
Option "AccelFactor" "0.06" | |
Option "PressureMotionMaxFactor" "3" |
/** | |
* colorToHex: Convert rgb(a) or 3-6 letters hexadecimal color code to 6 letters code, with alpha-support. | |
* Uses an optional background parameter to control how colors with alpha channels are converted | |
* | |
* Not supported: color names such as "red", "green" (if you want to preserve those, then modify the function) | |
* | |
* Usage examples: | |
* colorToHex("#3F3") -> "#33ff33" | |
* colorToHex("rgba(255, 0, 0, 0.5)") -> "#ff8080" | |
* colorToHex("rgba(255,0,0,.5)", "rgb(0,255,0)") —> "#808000" |