# PaletteImageView **Repository Path**: OpenHarmony1/PaletteImageView ## Basic Information - **Project Name**: PaletteImageView - **Description**: 一个可以解析图片主体颜色并为图片设置相应颜色阴影,也可根据主色调设置颜色接近的文字或背景的组件 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-11-01 - **Last Updated**: 2023-05-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PaletteImageView #### 项目介绍 一个可以解析图片主体颜色并为图片设置相应颜色阴影,也可根据主色调设置颜色接近的文字或背景的组件(ets) #### 项目演示 ![输入图片说明](./screenshot/demo_1.gif) ##### 基础用法 ```java PaletteImageView({ src: $r("app.media.img8"),//此处也可以是网络url或者PixelMap mainColorAlpha: 0.9, offsetX: 20, offsetY: 20, callback: (color) => { console.log('gao:onCallback:' + color) this.color = color; } }); ``` #### 接口及属性 | **属性** | **必填** | **说明** | | ------------------------------------ | :------: | --------------------------------------------------------- | | src: String、Resource、PixelMap | 是 | 资源或资源路径 | | offsetX: Number | 否 | 阴影x方向偏移量,默认0 | | offsetY: Number | 否 | 阴影y方向偏移量,默认0 | | mainColorAlpha: Number | 否 | 主色调透明度,默认1 | | shadowRadius: Number | 否 | 阴影扩散范围,默认15 | | shadowBlur: Number | 否 | 阴影模糊系数,默认10 | | callback: Function | 否 | 回调阴影颜色值 | | width: Number | 否 | 宽,默认100% | | height: Number | 否 | 高,默认100% | #### 版权和许可信息 ``` Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```