/color-saturation

一行代码实现全局变灰,支持指定View

Primary LanguageJava

color-saturation

一行代码实现全局变灰,支持指定View

Platform

依赖导入

项目根目录

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

模块目录

dependencies {
	implementation 'com.github.lavalike:color-saturation:0.0.1'
}

属性说明

饱和度范围(0.0~1.0)

SaturationScale.GRAY = 0 SaturationScale.IDENTITY = 1

代码示例

全局变灰

Application#onCreate初始化

ColorSaturation.init(SaturationScale.GRAY | SaturationScale.IDENTITY);

指定View变灰

ColorSaturation.apply(View, SaturationScale.GRAY | SaturationScale.IDENTITY);