Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangliang_wd
2024-08-21 11:06:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e3f75fa4843cefa3bc03c7bcc6fe26ea115460e0
e3f75fa4
1 parent
99835f81
feat:优化早晚报背景色
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/features/wdComponent/src/main/ets/utils/ColorUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
e3f75fa
...
...
@@ -25,6 +25,8 @@ import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent';
import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
import { ColorUtils } from '../../utils/ColorUtils';
const TAG = 'MorningEveningPaperComponent';
...
...
@@ -217,7 +219,9 @@ export struct MorningEveningPaperComponent {
console.log(TAG, "compInfoBean compStyle = " + imageUrl)
if (this.pageInfoBean.backgroundColor.length > 0){
this.mixedBgColor = this.pageInfoBean.backgroundColor
let colorDatas = ColorUtils.hexColorValueToRGB(this.pageInfoBean.backgroundColor)
let color = ColorUtils.getMorningEveningPaperRgb({red:colorDatas[0],green:colorDatas[1],blue:colorDatas[2],alpha:1})
this.mixedBgColor = "#ff" + color.red.toString(16).padStart(2,'0') + color.green.toString(16).padStart(2,'0') + color.blue.toString(16).padStart(2,'0');
return
}
...
...
@@ -251,9 +255,9 @@ export struct MorningEveningPaperComponent {
effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
let color = colorPicker.getLargestProportionColor();
console.log(TAG, "compInfoBean compStyle = " + color)
//
color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16).padStart(2,'0') + color.green.toString(16).padStart(2,'0') + color.blue.toString(16).padStart(2,'0');
this.mixedBgColor = "#
ff
" + color.alpha.toString(16) + color.red.toString(16).padStart(2,'0') + color.green.toString(16).padStart(2,'0') + color.blue.toString(16).padStart(2,'0');
console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
});
}
...
...
sight_harmony/features/wdComponent/src/main/ets/utils/ColorUtils.ets
View file @
e3f75fa
...
...
@@ -179,14 +179,16 @@ export class ColorUtils {
public static getMorningEveningPaperRgb(color: ColorRgb): ColorRgb {
// RGB颜色取值范围是0~255,需要转换为0~1的浮点数
const red: number = color.red;
const green: number = color.green;
const blue: number = color.blue;
const red: number = color.red / MAX_RGB_VALUE;
const green: number = color.green / MAX_RGB_VALUE;
const blue: number = color.blue / MAX_RGB_VALUE;
const max: number = Math.max(red, green, blue);
const min: number = Math.min(red, green, blue);
const delta: number = max - min;
// 色调
let hue: number = 0;
// 饱和度
...
...
Please
register
or
login
to post a comment