Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default CSS filter values for brightness and contrast [duplicate]

Recently I've updated Chrome to v.26 and pictures which were displayed using HTML5 canvas were not visible anymore. As I found I had to change to brightness and contrast.

How are the values for BC for CSS filters different depending on the browser engine?

Default:

Brightness:  0; contrast 100: Firefox ? 
Brightness:100; contrast:100: Chrome ?

As I found out it is actually a bug fix for Chrome: https://code.google.com/p/chromium/issues/detail?id=168004

like image 356
Jacob Avatar asked Apr 02 '13 06:04

Jacob


People also ask

How do I apply a brightness filter in CSS?

To set image brightness in CSS, use filter brightness(%). Remember, the value 0 makes the image black, 100% is for original image and default. Rest, you can set any value of your choice, but values above 100% would make the image brighter.

What is CSS brightness?

The brightness() CSS function applies a linear multiplier to the input image, making it appear brighter or darker.

What is the default value of Blur property in CSS?

0% (0) is default and represents the original image. 100% will make the image completely inverted.

What is filter rule in CSS?

The filter CSS property applies graphical effects like blur or color shift to an element. Filters are commonly used to adjust the rendering of images, backgrounds, and borders. Included in the CSS standard are several functions that achieve predefined effects.


1 Answers

I found this and it will certainly help you. The syntax is something like this.

.thing_you_want_to_filter {
  /*
    these are all default values, note that hue-rotate and blur have units.
    You'll also need to include the vendor prefixes.
  */
  filter: grayscale(0);
  filter: sepia(0);
  filter: saturate(1);
  filter: hue-rotate(0deg);
  filter: invert(0);
  filter: opacity(1);
  filter: brightness(0);
  filter: contrast(1);
  filter: blur(0px);

  /* Drop shadow has the same syntax as box-shadow – see below for why it's amazing! */
  filter: drop-shadow(5px 5px 10px #ccc);
}

Chrome 18.0+ and Safari 6+ are the only browsers that support this. For Safari under version 6 it would be like this:

.img
 {
  -webkit-filter:contrast(100%); /* play with the percentages */
  -webkit-filter:brightness(100%);
 }

You can read the sources yourself

http://net.tutsplus.com/tutorials/html-css-techniques/say-hello-to-css3-filters/ http://css3.bradshawenterprises.com/filters/

like image 82
Darwin Santos Arismendy Avatar answered Oct 01 '22 05:10

Darwin Santos Arismendy