Summary of the invention
The embodiment of the present invention provides a kind of user interface character displaying method and device, to solve the wallpaper figure of terminal UIIt needs the color of text to be shown same or similar on piece and UI, leads to the unsharp problem of text importing.
Specific technical solution provided in an embodiment of the present invention is as follows:
In a first aspect, the embodiment of the invention provides a kind of user interface text colors to determine method, comprising:
Terminal determines color value section belonging to each pixel for the wallpaper picture that user interface uses, color value section rootIt is determined according to the value range of the red R component of pixel, green G component and blue B component;
The terminal is directed to each color value section respectively, determines pixel number and the wall that the color value section includesThe ratio for the sum of all pixels that paper picture includes, and determine that the brightness of all pixels that the color value section is included is averagedValue;
The terminal is according to the average value and the ratio of each corresponding brightness in color value section, reallyThe color of text in the fixed user interface.
In possible embodiment, the terminal is averaged according to each corresponding brightness in color value sectionValue and the ratio, determine the color of text in the user interface, comprising:
The terminal determines that the average value of the brightness meets each of the first preset condition color value section, and calculatesThe sum for meeting each of the first preset condition corresponding ratio in the color value section;
The terminal determines text in the user interface if it is determined that be calculated and value the second preset condition of satisfactionColor belongs to first kind color, otherwise, it determines the color of text belongs to the second class color in the user interface.
In possible embodiment, the terminal is averaged according to each corresponding brightness in color value sectionValue and the ratio, determine the color of text in the user interface, comprising:
The terminal determines that the average value of the brightness is greater than or equal to each of the first preset value color value section, andIt is corresponding described that the average value that calculating meets the brightness is greater than or equal to each of the first preset value color value sectionThe sum of ratio, wherein the color value section that the average value of the brightness is greater than or equal to first preset value belongs to light type;
The terminal is if it is determined that be calculated and value determines that the user interface is above more than or equal to the second preset valueThe color of word belongs to first kind color, otherwise, it determines the color of text belongs to the second class color in the user interface, describedDepth of the depth of a kind of color less than the second class color.
In possible embodiment, the terminal is averaged according to each corresponding brightness in color value sectionValue and the ratio, determine the color of text in the user interface, comprising:
The terminal determines that the average value of the brightness is less than or equal to each of the first preset value color value section, andIt is corresponding described that the average value that calculating meets the brightness is less than or equal to each of the first preset value color value sectionThe sum of ratio, wherein the color value section that the average value of the brightness is less than or equal to first preset value belongs to dark type;
The terminal is if it is determined that be calculated and value determines that the user interface is above less than or equal to the second preset valueThe display color of word belongs to first kind color, otherwise, it determines the display color of text belongs to the second class face in the user interfaceColor, the depth of the depth of the first kind color less than the second class color.
In possible embodiment, the first kind color is black, and the second class color is white.
Second aspect, the embodiment of the invention provides a kind of user interface text color determining devices, comprising:
First processing module, for determining color value section belonging to each pixel of wallpaper picture that user interface uses,The color value section is determined according to the value range of the red R component of pixel, green G component and blue B component;
Second processing module determines the pixel that the color value section includes for being directed to each color value section respectivelyThe ratio of several sum of all pixels for including with the wallpaper picture, and determine the bright of all pixels that the color value section is includedThe average value of degree;
Third processing module, for according to each corresponding brightness in color value section average value and instituteRatio is stated, determines the color of text in the user interface.
In possible embodiment, the third processing module is specifically used for:
It determines that the average value of the brightness meets each of the first preset condition color value section, and calculates the satisfactionThe sum of the corresponding ratio in each of the first preset condition color value section;
If it is determined that be calculated and value meets the second preset condition, determine that the color of text in the user interface belongs toFirst kind color, otherwise, it determines the color of text belongs to the second class color in the user interface.
In possible embodiment, the third processing module is specifically used for:
It determines that the average value of the brightness is greater than or equal to each of the first preset value color value section, and calculates satisfactionThe average value of the brightness is greater than or equal to the sum of each of the first preset value corresponding ratio in the color value section,Wherein, the color value section that the average value of the brightness is greater than or equal to first preset value belongs to light type;
If it is determined that be calculated and value is greater than or equal to the second preset value, the color of text in the user interface is determinedBelong to first kind color, otherwise, it determines the color of text belongs to the second class color, the first kind color in the user interfaceDepth less than the second class color depth.
In possible embodiment, the third processing module is specifically used for:
It determines that the average value of the brightness is less than or equal to each of the first preset value color value section, and calculates satisfactionThe average value of the brightness is less than or equal to the sum of each of the first preset value corresponding ratio in the color value section,Wherein, the color value section that the average value of the brightness is less than or equal to first preset value belongs to dark type;
If it is determined that be calculated and value is less than or equal to the second preset value, the display of text in the user interface is determinedColor belongs to first kind color, otherwise, it determines the display color of text belongs to the second class color in the user interface, describedDepth of the depth of a kind of color less than the second class color.
In possible embodiment, the first kind color is black, and the second class color is white.
Based on the above-mentioned technical proposal, in the embodiment of the present invention, terminal is by each of wallpaper picture used in user interfacePixel returns the corresponding color value section of value, for each color value section, count the picture of pixel number and ratio that the color value section includesThe ratio of plain sum, and determine the average value of the brightness for all pixels that the color value section is included, according to each color value areaBetween corresponding brightness average value and the ratio, determine the display color of text in the user interface so thatTerminal according to the display color of the adaptively selected text of color of wallpaper picture, can guarantee the color and text of wallpaper pictureContrast between color, so as to avoid text to be shown is needed in the wallpaper picture and the user interface of end-user interfaceColor it is same or similar, lead to the unsharp problem of text importing.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make intoIt is described in detail to one step, it is clear that described embodiments are only a part of the embodiments of the present invention, rather than whole implementationExample.Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative effortsAll other embodiment, shall fall within the protection scope of the present invention.
It needs the color of text to be shown same or similar in wallpaper picture and UI in order to solve terminal UI, leads to textShow unsharp problem, the embodiment of the invention provides one kind adaptively to determine text color according to wallpaper picture colorMethod.
The core idea of the invention is as follows: each pixel that wallpaper picture is included by terminal is returned respectively to affiliated color value areaBetween, the average value of the brightness by counting the pixel number that each color value section includes and the pixel that each color value section includes,The body color for determining wallpaper picture determines the display color of text in user interface according to the body color of wallpaper picture, withGuarantee that the contrast of the display color of text and the body color of wallpaper picture is sufficiently large, reaches text importing clearly purpose.
Mode is preferably carried out to the present invention below in conjunction with attached drawing to be described in detail.
In the embodiment of the present invention, as shown in Figure 1, text color determination process is specific as follows on end-user interface:
Step 101: terminal determines color value section belonging to each pixel for the wallpaper picture that user interface uses, whereinColor value section is determined according to the value range of red (R) component of pixel, green (G) component and blue (B) component.
Multiple color value sections are preset in implementation, in terminal, red (R) component, green (G) corresponding to each color value sectionAt least one component is not identical in component and blue (B) component.
In the embodiment of the present invention, the number in the color value section that terminal uses can be technical field of image processing common 32Color value section or 64 color value sections or 128 color value sections etc..
Specifically, terminal is if it is determined that the R component of pixel belongs to the value interval of the R component in a certain color value section, the pictureThe G component of element belongs to the value interval of the G component in the color value section, and the B component of the pixel belongs to the B component in the color value sectionValue interval, it is determined that the pixel belongs to the color value section.
Step 102: terminal is directed to each color value section respectively, determines pixel number and wallpaper picture that the color value section includesThe ratio for the sum of all pixels for including, and determine the average value of the brightness for all pixels that the color value section is included.
Specifically, terminal determines coloration (Hue, abbreviation H) component of each pixel of wallpaper picture, saturation degree(Saturation, abbreviation S) component and brightness (Lightness, L) component.Wherein, the value range of L * component are as follows: 0≤L≤1,Wherein, black is represented when L value is 0, value is to explain color in 1 epoch.
For example, terminal determines that the sum of all pixels that wallpaper picture includes is 256, in the pixel number for belonging to a certain color value sectionIt is 15, it is determined that the ratio for the sum of all pixels that the pixel number and wallpaper picture that the color value section includes include is 15/256.
Specifically, for any one color value section, terminal determines L points of each pixel that the color value section is includedAmount calculates the sum of the value of the L * component for each pixel that the color value section includes, and obtain and value is wrapped divided by the color value sectionThe number of the pixel contained obtains the average value of the brightness for all pixels that the color value section is included.
Step 103: terminal is according to the average value and the ratio of the corresponding brightness in each color value section, reallyDetermine the color of text in user interface.
In implementation, terminal is according to the average value and the ratio of each corresponding brightness in color value sectionValue, determines the color of text in the user interface, detailed process are as follows:
Terminal determines that the average value of the brightness meets each color value section of the first preset condition, and calculates the satisfactionThe sum of the corresponding ratio in each color value section of first preset condition;
Terminal determines that the color of text belongs in user interface if it is determined that be calculated and value the second preset condition of satisfactionFirst kind color, otherwise, it determines the color of text belongs to the second class color in user interface.
Wherein, first kind color and the color depth of the second class color are significantly different.
Specifically, terminal is according to the average value and the ratio of each corresponding brightness in color value sectionValue, determines the color of text in the user interface, including but not limited to following two specific embodiment:
The first embodiment
Terminal determines that the average value of brightness is greater than or equal to each color value section of the first preset value, and calculates and meet brightnessAverage value be greater than or equal to the first preset value the corresponding ratio in each color value section sum, wherein brightnessThe color value section that average value is greater than or equal to the first preset value belongs to light type;
Terminal is if it is determined that be calculated and value determines the color of text in user interface more than or equal to the second preset valueBelong to first kind color, otherwise, it determines the color of text belongs to the second class color in user interface, wherein first kind colorDepth of the depth less than the second class color.
Second of embodiment
Terminal determines that the average value of brightness is less than or equal to each color value section of the first preset value, and calculates and meet brightnessAverage value be less than or equal to the first preset value the corresponding ratio in each color value section sum, wherein brightnessThe color value section that average value is less than or equal to the first preset value belongs to dark type;
Terminal is if it is determined that be calculated and value determines the color of text in user interface less than or equal to the second preset valueBelong to first kind color, otherwise, it determines the color of text belongs to the second class color in user interface, wherein first kind colorDepth of the depth less than the second class color.
Preferably, in first and second kinds of embodiments, first kind color is black, and the second class color is white.It is optionalGround, first kind color are black and translucent.
Optionally, the first preset value is 0.8, if the average value of the brightness for all pixels that a color value section is included is smallIn or be equal to 0.8, then can determine that the color value section belongs to dark color, otherwise, it determines the color value section belongs to light color.Alternatively, if oneThe average value of the brightness for all pixels that a color value section is included is greater than or equal to 0.8, then can determine that the color value section belongs toLight color, otherwise, it determines the color value section belongs to dark color.
Optionally, the second preset value is 0.5, if the average value that calculating meets brightness is less than or equal to the every of the first preset valueThe sum of a corresponding ratio in color value section, if obtaining the sum value less than or equal to 0.5, it is determined that belong to each of dark colorThe sum for the pixel that color value section is included determines wallpaper picture entirety less than the half for the sum of all pixels that wallpaper picture includesBelong to light type;If obtain and value is greater than 0.5, it is determined that belong to the total of the pixel that dark each color value section is includedNumber, greater than the half for the sum of all pixels that wallpaper picture includes, determines that wallpaper picture integrally belongs to dark type.
The determination process of user interface text color is illustrated below by way of an example, as shown in Fig. 2, toolBody is as follows:
Step 201: terminal selects a certain wallpaper picture as desktop wallpaper according to user's operation determination;
Step 202: the pixel that terminal includes to the wallpaper picture of selection is sorted out, specially according to the R component of pixel,G component, B component return the pixel to color value section, it is assumed herein that color value section be it is N number of, be expressed as color [i], wherein 1≤I≤N, color value section are determined by the interval range of R component, G component and B component;
Step 203: terminal is directed to each color value section respectively, calculates pixel number and wallpaper picture that the color value section includesThe ratio for the sum of all pixels for including, the ratio are known as the ratio in the color value section, are expressed as population [i];
Step 204: terminal determines the H component, S component and L * component of each pixel of wallpaper picture, wherein the value of L * componentRange are as follows: 0≤L≤1, wherein L value represents black when being 0, value is to explain color in 1 epoch;
Step 205: terminal is directed to each color value section respectively, calculates the L * component for all pixels that the color value section includesAverage value, according to the average value determine the color value section belonging to color type, specifically: judging whether the average value is greater thanOr it is equal to 0.8, if so, determining that the color value section belongs to light type, otherwise, it is determined that the color value section belongs to dark type;
Step 206: terminal calculates the sum of the ratio in all color value sections for belonging to light type, and judge and value isIt is no to be greater than 0.5, if so, the color of setting desktop text is translucent for dark color, such as black, otherwise, the face of desktop text is setColor is light color, such as white.
For example, be illustrated in figure 3 wallpaper picture, table 1 show the color value section determined according to the wallpaper picture ratio,Color type belonging to the average value of the L * component for all pixels that color value section is included and the color value section.Wherein, ifThe average value of the L * component for all pixels that color value section is included is greater than 0.8, then the color type in the color value section is light classType, if the ratio in all color value sections for belonging to light type and be less than threshold value 0.5, it is determined that the wallpaper picture is generallyDark picture, then the color of desktop text is white.It is 0 to 11, G that first color value section in table 1, which is R component value range,Component value range is 0 to 12, and the value range of B component is 0 to 61;Second color value section is R component value range in table 1The value range for being 11 to 34, G component is 12 to 102, and the value range of B component is 61 to 212, the value in other color value sectionsRange and so on.
For example, be illustrated in figure 4 wallpaper picture, table 2 show the color value section determined according to the wallpaper picture ratio,Color type belonging to the average value of the L * component for all pixels that color value section is included and the color value section.Wherein, ifThe average value of the L * component for all pixels that color value section is included is greater than 0.8, then the color type in the color value section is light classType, if the ratio in all color value sections for belonging to light type and be greater than threshold value 0.5, it is determined that the wallpaper picture is generallyLight picture, then the color of desktop text is black.
Specifically, it is illustrated in figure 5 the display effect schematic diagram that text color is white, is illustrated in figure 6 text colorFor the display effect schematic diagram of black.
Based on the same inventive concept, a kind of user interface text color determining device is provided in the embodiment of the present invention, it shouldIt can dispose at the terminal, the specific implementation of the device can be found in the description of embodiment of the method part, and overlaps will not be repeated,As shown in fig. 7, the device mainly includes:
First processing module 701, for determining color value area belonging to each pixel of wallpaper picture that user interface usesBetween, the color value section is determined according to the value range of the red R component of pixel, green G component and blue B component;
Second processing module 702 determines the picture that the color value section includes for being directed to each color value section respectivelyThe ratio for the sum of all pixels that prime number and the wallpaper picture include, and determine all pixels that the color value section is includedThe average value of brightness;
Third processing module 703, for according to the average value of each corresponding brightness in color value section withAnd the ratio, determine the color of text in the user interface.
In possible embodiment, third processing module is specifically used for:
It determines that the average value of the brightness meets each of the first preset condition color value section, and calculates the satisfactionThe sum of the corresponding ratio in each of the first preset condition color value section;
If it is determined that be calculated and value meets the second preset condition, determine that the color of text in the user interface belongs toFirst kind color, otherwise, it determines the color of text belongs to the second class color in the user interface.
In possible embodiment, third processing module is specifically used for:
It determines that the average value of the brightness is greater than or equal to each of the first preset value color value section, and calculates satisfactionThe average value of the brightness is greater than or equal to the sum of each of the first preset value corresponding ratio in the color value section,Wherein, the color value section that the average value of the brightness is greater than or equal to first preset value belongs to light type;
If it is determined that be calculated and value is greater than or equal to the second preset value, the color of text in the user interface is determinedBelong to first kind color, otherwise, it determines the color of text belongs to the second class color, the first kind color in the user interfaceDepth less than the second class color depth.
In possible embodiment, third processing module is specifically used for:
It determines that the average value of the brightness is less than or equal to each of the first preset value color value section, and calculates satisfactionThe average value of the brightness is less than or equal to the sum of each of the first preset value corresponding ratio in the color value section,Wherein, the color value section that the average value of the brightness is less than or equal to first preset value belongs to dark type;
If it is determined that be calculated and value is less than or equal to the second preset value, the display of text in the user interface is determinedColor belongs to first kind color, otherwise, it determines the display color of text belongs to the second class color in the user interface, describedDepth of the depth of a kind of color less than the second class color.
Preferably, the first kind color is black, and the second class color is white.
Based on the above-mentioned technical proposal, in the embodiment of the present invention, terminal is by each of wallpaper picture used in user interfacePixel returns the corresponding color value section of value, for each color value section, count the picture of pixel number and ratio that the color value section includesThe ratio of plain sum, and determine the average value of the brightness for all pixels that the color value section is included, according to each color value areaBetween corresponding brightness average value and the ratio, determine the display color of text in the user interface so thatTerminal according to the display color of the adaptively selected text of color of wallpaper picture, can guarantee the color and text of wallpaper pictureContrast between color, so as to avoid text to be shown is needed in the wallpaper picture and the user interface of end-user interfaceColor it is same or similar, lead to the unsharp problem of text importing.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer programProduct.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present inventionApply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more,The shape for the computer program product implemented in usable storage medium (including but not limited to magnetic disk storage and optical memory etc.)Formula.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program productFigure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructionsThe combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programsInstruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produceA raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for realThe device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spyDetermine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram orThe function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that countingSeries of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer orThe instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram oneThe step of function of being specified in a box or multiple boxes.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the artMind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologiesWithin, then the present invention is also intended to include these modifications and variations.