A Dynamic Adjustment Method and System for an Adaptive User Interface
By monitoring and analyzing the contrast of user interface elements in real time, a scientific color adjustment strategy is formulated, which solves the problem of insufficient contrast in traditional user interface design, realizes adaptive dynamic adjustment, and improves user experience and interface quality.
Patent Information
- Application Number
- CN202411896714.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2044-12-23
AI Technical Summary
Traditional user interface design methods are difficult to ensure that interface elements maintain good contrast in different environments, affecting user efficiency and comfort, and it is difficult to make frequent adjustments and optimizations efficiently and accurately.
It provides a dynamic adjustment method for adaptive user interfaces. By monitoring and analyzing the contrast of interface elements in real time, formulating scientific color adjustment strategies based on preset standard values, including color adjustment direction, number of times and target colors, and gradually adjusting the RGB color value to achieve good contrast.
It ensures good contrast of interface elements in different environments, improves user efficiency and comfort, and can automatically and efficiently adjust color to adapt to user needs and technological progress.
Smart Images

Figure CN119356788B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of user interface design, and in particular, to a method and system for dynamically adjusting an adaptive user interface. Background Art
[0002] With the rapid development of digital technology, the design of user interfaces (UIs) has become increasingly important. It not only concerns the user experience but also directly affects the market competitiveness of products. In the design of user interfaces, the contrast ratio of elements is one of the key factors to ensure information readability and visual attractiveness. However, in practical applications, due to the diversity of design elements and the differences in user environments, the contrast ratio of interface elements is often insufficient, which in turn affects the user's usage efficiency and comfort.
[0003] Traditional user interface design methods often rely on designers' experience and subjective judgment, lacking a scientific and systematic contrast adjustment mechanism. This results in it being difficult to ensure that all elements maintain good contrast ratios in different environments after the interface design is completed. In addition, with the continuous change of user requirements and the continuous progress of technology, interface elements may need to be frequently adjusted and optimized, and traditional methods often have difficulty in efficiently and accurately completing this task.
[0004] Therefore, it is necessary to provide a method and system for dynamically adjusting an adaptive user interface to solve the above technical problems. Summary of the Invention
[0005] To solve the above technical problems, the present invention provides a method and system for dynamically adjusting an adaptive user interface, which can monitor and analyze the contrast ratio of interface elements in real time and formulate a scientific color adjustment strategy according to a preset standard value to ensure that elements maintain good contrast ratios in different environments.
[0006] The present invention provides a method for dynamically adjusting an adaptive user interface, and the dynamic adjustment method includes the following steps:
[0007] Extract the RGB color values of the foreground and background of each element from the user interface, and convert the RGB color values of the foreground and background into corresponding HSV color values respectively;
[0008] Calculate the contrast ratio of the corresponding element based on the RGB color value and HSV color value, and determine whether the contrast ratio of the element meets a preset standard value;
[0009] When the contrast ratio of the element does not meet the preset standard value, formulate a color adjustment strategy based on the contrast ratio of the corresponding element, where the color adjustment strategy includes a color adjustment direction, a color adjustment number of times, and a target color;
[0010] In the color adjustment direction, the RGB color values of the corresponding elements are progressively adjusted according to the number of color adjustment times until the RGB color values gradually transition to the target color.
[0011] Preferably, the conversion of the RGB color value to the HSV color value adopts the following formula:
[0012] V = max(R, G, B);
[0013] C = V - min(R, G, B);
[0014]
[0015] The calculation of H depends on the position of the maximum value, specifically:
[0016] If V = R, then
[0017] If V = G, then
[0018] If V = B, then
[0019] Among them, R is the red component in the RGB color value, G is the green component in the RGB color value, B is the blue component in the RGB color value, H is the hue in the HSV color value, V is the brightness in the HSV color value, S is the saturation in the HSV color value, and C is the color difference.
[0020] Preferably, calculating the contrast ratio of the corresponding element based on the RGB color value and the HSV color value, and determining whether the contrast ratio of the element meets a preset standard value includes:
[0021] Calculating the RGB contrast ratio based on the foreground and background in the RGB color value, and its calculation formula is:
[0022]
[0023] Among them, L 1 is the brightness in the RGB color value of the foreground, L 2 is the brightness in the RGB color value of the background, K RGB is the RGB contrast ratio;
[0024] Calculating the HSV contrast ratio based on the foreground and background in the HSV color value, and its calculation formula is:
[0025]
[0026] Among them, V 1 is the brightness in the HSV color value of the foreground, V2 The brightness in the HSV color value with HSV K being the HSV contrast ratio;
[0027] Based on the RGB contrast ratio and the HSV contrast ratio, the contrast ratio of the element is calculated by weighted calculation, and its calculation formula is:
[0028] K = ω 1 ×K RGB + ω 2 ×K HSV
[0029] where ω 1 and ω 2 are respectively the preset weights of the RGB contrast ratio and the HSV contrast ratio, and K is the contrast ratio;
[0030] Judge whether the contrast ratio of the element obtained by weighted calculation is lower than the preset standard value. If it is lower than the preset standard value, mark the element as an object to be adjusted.
[0031] Preferably, when the contrast ratio of the element does not meet the preset standard value, a color adjustment strategy is formulated based on the contrast ratio of the corresponding element, including:
[0032] Judge the direction to be adjusted according to the contrast ratio of the element to obtain the color adjustment direction, where the color adjustment direction includes increasing and decreasing;
[0033] Calculate the color change amplitude based on the RGB color value and the HSV color value, and determine the number of color adjustments based on the color change amplitude, where the color change amplitude includes the RGB color change distance and the HSV color change distance;
[0034] Calculate the RGB value of the target color according to the target brightness value, where the target brightness value is determined based on the preset standard value.
[0035] Preferably, the calculating the color change amplitude based on the RGB color value and the HSV color value, and determining the number of color adjustments based on the color change amplitude includes:
[0036] For the RGB color change distance, its calculation formula is:
[0037]
[0038] where R 1 and R 2 are respectively the red components of the foreground and the background, G 1 and G 2 are respectively the green components of the foreground and the background, B 1 and B2 The blue components of the foreground and background respectively;
[0039] For the HSV color change distance, its calculation formula is:
[0040]
[0041] Wherein, H 1 and H 2 are the hues of the foreground and background respectively, S 1 and S 2 are the saturations of the foreground and background respectively, V 1 and V 2 are the brightnesses of the foreground and background respectively;
[0042] For the color change amplitude, its calculation formula is:
[0043]
[0044] Wherein, D is the color change amplitude;
[0045] Determine the number of color adjustments according to a preset piecewise adjustment function, where the piecewise adjustment function is:
[0046]
[0047] Wherein, D 1 and D 2 are both preset thresholds, a, b, c, and d are preset parameters, and n is the number of color adjustments.
[0048] Preferably, calculate the RGB value of the target color according to the target brightness value, where the target brightness value is determined based on a preset standard value, including:
[0049] Determine the target brightness value based on a preset standard value;
[0050] Calculate the brightness adjustment ratio q based on the target brightness value, and its calculation formula is:
[0051]
[0052] Wherein, L t is the target brightness value;
[0053] Calculate the RGB value of the target color according to the brightness adjustment ratio, and its calculation formula is:
[0054] R new = R 1 ×q
[0055] G new = G 1×q
[0056] B new = B 1 ×q。
[0057] Preferably, in the color adjustment direction, the RGB color values of the corresponding elements are progressively adjusted according to the number of color adjustment times until the RGB color values gradually transition to the target color, including:
[0058] Calculate the brightness change step size for each adjustment according to the number of color adjustment times and the target brightness value;
[0059] In the color adjustment direction, according to the number of color adjustment times and the step size of each adjustment, gradually adjust the RGB values of the foreground until the RGB values of the target color are reached. The RGB value adjustment formula for the foreground is:
[0060]
[0061] Wherein, R new , G new and B new are the RGB values of the target color respectively, ΔL is the brightness change step size, and L 1 is the brightness in the RGB color value of the foreground.
[0062] The present invention also provides a dynamic adjustment system for an adaptive user interface, which is used to execute the dynamic adjustment method for an adaptive user interface. The dynamic adjustment system includes:
[0063] A color value extraction module, which is used to extract the RGB color values of the foreground and background of each element from the user interface, and convert the RGB color values of the foreground and background into corresponding HSV color values respectively;
[0064] A contrast evaluation module, which is used to calculate the contrast ratio of the corresponding element based on the RGB color value and the HSV color value, and determine whether the contrast ratio of the element meets a preset standard value;
[0065] An adjustment strategy formulation module, which is used to formulate a color adjustment strategy based on the contrast ratio of the corresponding element when the contrast ratio of the element does not meet the preset standard value. The color adjustment strategy includes a color adjustment direction, a number of color adjustment times, and a target color;
[0066] A color adjustment module, which is used to progressively adjust the RGB color values of the corresponding elements in the color adjustment direction according to the number of color adjustment times until the RGB color values gradually transition to the target color.
[0067] Compared with the related technologies, a dynamic adjustment method and system for an adaptive user interface provided by the present invention have the following beneficial effects:
[0068] By extracting the foreground and background color values of interface elements and converting them into the HSV color space for analysis, the present invention can more accurately evaluate the color contrast. At the same time, by combining the contrast ratios in both the RGB and HSV color spaces and calculating the comprehensive contrast of the elements through weighted calculation, the visual presentation effect of the elements can be more comprehensively reflected. When the contrast does not meet the preset standard, the present invention can automatically formulate a color adjustment strategy, including the color adjustment direction, number of times, and target color, and through a progressive adjustment method, gradually transition the RGB color values of the interface elements to the target color, realizing dynamic and adaptive color contrast adjustment. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 is a flowchart of a dynamic adjustment method for an adaptive user interface provided by the present invention;
[0070] Figure 2 is a schematic diagram of the module structure of a dynamic adjustment system for an adaptive user interface provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0071] The present invention will be further described in detail below with reference to the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present invention, rather than limiting the present invention. Additionally, it should be noted that for the sake of description, only parts related to the present invention are shown in the drawings rather than all structures. Furthermore, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other.
[0072] It should also be noted that for the sake of description, only parts related to the present invention are shown in the drawings rather than all content. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of the operations can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the operations can be rearranged. When the operations are completed, the process can be terminated, but there can also be additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0073] Embodiment 1
[0074] The present invention provides a dynamic adjustment method for an adaptive user interface. Referring to Figure 1 as shown, the dynamic adjustment method includes the following steps:
[0075] S1: Extract the RGB color values of the foreground and background of each element from the user interface, and convert the RGB color values of the foreground and background into the corresponding HSV color values respectively.
[0076] In this embodiment, first, extract the RGB color values of the foreground and background from each element of the user interface. This step can be completed through the graphics library in the programming language. Exemplarily, use DOM operations in JavaScript to obtain the style attributes of the element, or use the API provided by the platform in the mobile application to obtain the color information of the view.
[0077] After extracting the RGB color values, it is necessary to convert them into HSV color values. The HSV color model is more in line with the human perception of colors and can better represent the hue, saturation, and brightness of colors.
[0078] Specifically, the formula for converting RGB color values into HSV color values is:
[0079] V = max(R, G, B);
[0080] C = V - min(R, G, B);
[0081]
[0082] The calculation of H depends on the position of the maximum value, specifically:
[0083] If V = R, then
[0084] If V = G, then
[0085] If V = B, then
[0086] Among them, R is the red component in the RGB color value, G is the green component in the RGB color value, B is the blue component in the RGB color value, H is the hue in the HSV color value, V is the brightness in the HSV color value, S is the saturation in the HSV color value, and C is the color difference.
[0087] By extracting the RGB color values of the foreground and background of each element from the user interface and converting them into HSV color values, the characteristics of colors can be described more comprehensively. The RGB color model mainly focuses on the red, green, and blue components of colors, while the HSV color model focuses on the hue, saturation, and brightness of colors, which is more suitable for the calculation and adjustment of color contrast. The technical effect of this step is to provide accurate and comprehensive color information for the subsequent contrast calculation and color adjustment, ensuring the scientificity and reliability of the entire dynamic adjustment process.
[0088] S2: Calculate the contrast ratio of the corresponding element based on the RGB color value and the HSV color value, and determine whether the contrast ratio of the element meets the preset standard value.
[0089] Specifically, step S2 includes the following steps:
[0090] S21: Calculate the RGB contrast ratio based on the foreground and background in the RGB color value. The calculation formula is:
[0091]
[0092] where L 1 is the brightness in the RGB color value of the foreground, and L 2 is the brightness in the RGB color value of the background. K RGB is the RGB contrast ratio.
[0093] At the same time, the calculation formulas for L 1 and L 2 are respectively:
[0094] L 1 = 0.2123 × R 1 + 0.7152 × G 1 + 0.0722 × B 1
[0095] L 2 = 0.2123 × R 2 + 0.7152 × G 2 + 0.0722 × B 2
[0096] where R 1 and R 2 are the red components of the foreground and background respectively, G 1 and G 2 are the green components of the foreground and background respectively, B 1 and B 2 are the blue components of the foreground and background respectively. Among them, the coefficients 0.2123, 0.7152, and 0.0722 are defined according to the ITU-R BT.709 standard (also known as Rec.709), which is widely used in digital video and image processing. These coefficients ensure that the brightness value can better reflect the human eye's perception of different colors.
[0097] In this embodiment, by calculating the RGB contrast ratio, the contrast between the foreground and background colors can be quantified, providing basic data for subsequent contrast evaluation and color adjustment. This method is simple and efficient and applicable to most color combinations.
[0098] S22: Calculate the HSV contrast ratio based on the foreground and background in the HSV color values, and its calculation formula is:
[0099]
[0100] where V 1 is the brightness in the HSV color value of the foreground, V 2 is the brightness in the HSV color value of the background, and K HSV is the HSV contrast ratio.
[0101] In this embodiment, by calculating the HSV contrast ratio, the contrast between the foreground and background colors can be evaluated more accurately, especially in cases where the color saturation and hue differences are large. This helps improve the readability and accessibility of the user interface.
[0102] In the calculation formula of K RGB and K HSV Adding 0.05 to both the numerator and denominator is to avoid division-by-zero errors and make the calculation of the contrast ratio smoother and more stable. Because if the brightness values of the foreground and background are very close or equal, directly calculating the contrast ratio may cause the denominator to be close to zero, resulting in a division-by-zero error. Adding 0.05 can ensure that the denominator is always greater than zero.
[0103] S23: Calculate the contrast ratio of the element by weighted calculation based on the RGB contrast ratio and the HSV contrast ratio, and its calculation formula is:
[0104] K = ω 1 ×K RGB + ω 2 ×K HSV
[0105] where ω 1 and ω 2 are the preset weights of the RGB contrast ratio and the HSV contrast ratio respectively, and K is the contrast ratio.
[0106] In this embodiment, through experiments and user feedback, the following weight values are determined: ω 1 = 0.7, ω 2 = 0.3. The setting of these weight values means that when calculating the final contrast ratio, the RGB contrast ratio accounts for 70% of the weight, and the HSV contrast ratio accounts for 30% of the weight. Such a setting takes into account both the general applicability of the RGB model and the advantages of the HSV model in special color combinations.
[0107] The contrast ratio obtained through weighted calculation is more comprehensive and accurate, and can better reflect the contrast between the foreground and background colors. This helps to ensure that the visual effect of the user interface meets the preset standard values, improving the user's visual experience and the readability of the interface.
[0108] S24: Determine whether the contrast ratio of the element obtained through weighted calculation is lower than the preset standard value. If it is lower than the preset standard value, mark the element as an object to be adjusted.
[0109] To ensure that the visual effect of the user interface meets the preset standard values, it is necessary to judge the calculated contrast ratio. If the contrast ratio is lower than the preset standard value, the color of the element needs to be adjusted to increase the contrast.
[0110] In this embodiment, first determine whether the contrast ratio obtained through weighted calculation is lower than the preset standard value. If it is less, mark the element as an object to be adjusted. By judging whether the contrast ratio meets the preset standard value, the interface elements that need color adjustment can be accurately identified. This helps to ensure that the contrast of all interface elements meets the preset requirements, thereby improving the overall visual effect and user experience of the user interface.
[0111] S3: When the contrast ratio of the element does not meet the preset standard value, formulate a color adjustment strategy based on the contrast ratio of the corresponding element, where the color adjustment strategy includes a color adjustment direction, a color adjustment frequency, and a target color.
[0112] Specifically, step S3 includes the following steps:
[0113] S31: Determine the direction of adjustment required based on the contrast ratio of the element to obtain the color adjustment direction, where the color adjustment direction includes increasing and decreasing.
[0114] In user interface design, the contrast between the foreground and background colors directly affects the user's visual experience. If the contrast is too low, the user may have difficulty distinguishing the foreground from the background, resulting in reading difficulties. Therefore, it is necessary to judge the color adjustment direction based on the contrast ratio to increase the contrast. The adjustment direction can be to increase the brightness or decrease the brightness, depending on the current brightness value and the target brightness value of the color.
[0115] In this embodiment, when it is determined that adjustment is required, judge the direction of adjustment based on the contrast ratio:
[0116] If the foreground color is too light (high brightness), then the brightness of the foreground color needs to be reduced, that is, the brightness is decreased.
[0117] If the foreground color is too dark (low brightness), then the brightness of the foreground color needs to be increased, that is, the brightness is increased.
[0118] S32: Calculate the color change amplitude based on the RGB color value and the HSV color value, and determine the number of color adjustment times based on the color change amplitude, where the color change amplitude includes the RGB color change distance and the HSV color change distance.
[0119] To achieve smooth color adjustment, it is necessary to calculate the amplitude of color change and determine the number of adjustments based on the amplitude. The color change amplitude includes the RGB color change distance and the HSV color change distance, which can reflect the difference between the foreground and background colors. By determining the number of adjustments, it can be ensured that each step in the color adjustment process is gradual, avoiding abrupt changes.
[0120] Specifically, in step S32, the calculation formulas for each value are as follows:
[0121] For the RGB color change distance, its calculation formula is:
[0122]
[0123] where R 1 and R 2 are the red components of the foreground and background respectively, G 1 and G 2 are the green components of the foreground and background respectively, B 1 and B 2 are the blue components of the foreground and background respectively.
[0124] For the HSV color change distance, its calculation formula is:
[0125]
[0126] where H 1 and H 2 are the hues of the foreground and background respectively, S 1 and S 2 are the saturations of the foreground and background respectively, V 1 and V 2 are the brightnesses of the foreground and background respectively.
[0127] For the color change amplitude, its calculation formula is:
[0128]
[0129] where D is the color change amplitude;
[0130] Determine the number of color adjustment times according to a preset piecewise adjustment function, where the piecewise adjustment function is:
[0131]
[0132] Among them, D 1 and D 2 are both preset thresholds, a, b, c, and d are preset parameters, and n is the number of color adjustment times.
[0133] In this formula, calculating the number of color adjustment times according to the interval where the color change amplitude D is located can ensure that each step in the color adjustment process is gradual, avoiding abrupt changes, which helps to achieve smooth color transition and improve the visual effect and user experience of the user interface.
[0134] S33: Calculate the RGB values of the target color according to the target brightness value, where the target brightness value is determined based on a preset standard value.
[0135] To ensure that the adjusted color can reach the preset standard value, it is necessary to calculate the RGB values of the target color. The target brightness value is determined according to the preset standard value, which is a fixed brightness value, such as L t = 128. By calculating the target brightness value, it can be ensured that the adjusted color has appropriate brightness, thereby improving the contrast.
[0136] Specifically, step S33 includes the following steps:
[0137] S33a: Determine the target brightness value based on the preset standard value.
[0138] S33b: Calculate the brightness adjustment ratio q based on the target brightness value, and its calculation formula is:
[0139]
[0140] Among them, L t is the target brightness value.
[0141] S33c: Calculate the RGB values of the target color according to the brightness adjustment ratio, and its calculation formula is:
[0142] R new = R 1 ×q
[0143] G new = G 1 ×q
[0144] B new = B 1 ×q.
[0145] In this embodiment, by calculating the RGB values of the target color, it is possible to ensure that the adjusted color has appropriate brightness, thereby improving the contrast. This helps to ensure that the visual effect of the user interface meets the preset standard values, enhancing the user's visual experience and the readability of the interface.
[0146] S4: In the color adjustment direction, progressively adjust the RGB color values of the corresponding elements according to the number of color adjustment times until the RGB color values gradually transition to the target color.
[0147] Specifically, step S4 includes the following steps:
[0148] S41: Calculate the brightness change step size for each adjustment according to the number of color adjustment times and the target brightness value.
[0149] In this embodiment, during the color adjustment process, in order to achieve a smooth transition effect, it is necessary to decompose the color adjustment into multiple steps. In each step, the change in color should be progressive, which can avoid the visual discomfort caused by sudden color changes. Calculating the brightness change step size for each adjustment is a key step to achieve this goal.
[0150] By calculating the brightness change step size for each adjustment, it can be ensured that each step in the color adjustment process is smooth and controllable. This helps to avoid sudden color changes, enhance the user's visual experience, and make the color transition more natural and smooth.
[0151] S42: In the color adjustment direction, successively adjust the RGB values of the foreground according to the number of color adjustment times and the step size for each adjustment until the RGB values of the target color are reached. The RGB value adjustment formula for the foreground is:
[0152]
[0153] where R new , G new and B new are the RGB values of the target color respectively, ΔL is the brightness change step size, and L 1 is the brightness in the RGB color value of the foreground.
[0154] In this embodiment, after determining the brightness change step size for each adjustment, it is necessary to successively adjust the RGB values of the foreground color in the color adjustment direction until the target color is reached. This process requires precise control of the change in RGB values for each adjustment to ensure that the final color meets the preset standard values.
[0155] By successively adjusting the RGB values of the foreground color, a smooth transition from the current color to the target color can be achieved. This method not only ensures the accuracy of color adjustment but also enhances the visual effect of the user interface, making the color change more natural and smooth. Ultimately, all elements that need to be adjusted can meet the preset contrast standard, improving the overall quality and user experience of the user interface.
[0156] Embodiment 2
[0157] The present invention also provides an adaptive dynamic adjustment system for a user interface, which is used to execute the dynamic adjustment method for an adaptive user interface, as shown in Figure 2 shown, the dynamic adjustment system includes:
[0158] A color value extraction module 100, which is used to extract the RGB color values of the foreground and background of each element from the user interface, and convert the RGB color values of the foreground and background into corresponding HSV color values respectively.
[0159] A contrast evaluation module 200, which is used to calculate the contrast ratio of the corresponding element based on the RGB color value and HSV color value, and determine whether the contrast ratio of the element meets the preset standard value.
[0160] An adjustment strategy formulation module 300, which is used to formulate a color adjustment strategy based on the contrast ratio of the corresponding element when the contrast ratio of the element does not meet the preset standard value, where the color adjustment strategy includes a color adjustment direction, a color adjustment number of times, and a target color.
[0161] A color adjustment module 400, which is used to progressively adjust the RGB color value of the corresponding element in the color adjustment direction according to the color adjustment number of times until the RGB color value gradually transitions to the target color.
[0162] This application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of this application. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the processes and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for realizing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0163] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium includes read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc memories, magnetic disk memories, tape memories, or any other medium that can be used to carry or store data and is computer-readable.
[0164] It should also be noted that the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such a process, method, commodity or device. Without further limitations, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, commodity or device including the element.
Claims
1. A method for dynamically adjusting an adaptive user interface, characterized in that: The dynamic adjustment method comprises the following steps: Extract the RGB color values of the foreground and background of each element from the user interface, and convert the RGB color values of the foreground and background into corresponding HSV color values respectively; Calculating the contrast ratio of the corresponding element based on the RGB color value and the HSV color value, and determining whether the contrast ratio of the element meets a preset standard value; Specifically include: The RGB contrast ratio is calculated based on the foreground and background in the RGB color value, and the calculation formula is: Among them, L1 is the brightness of the RGB color value of the foreground, L2 is the brightness of the RGB color value of the background, and K RGB is the RGB contrast ratio; The HSV contrast ratio is calculated based on the foreground and background in the HSV color value, and the calculation formula is: Among them, V1 is the brightness of the foreground in the HSV color value, V2 is the brightness of the background in the HSV color value, and K HSV is the HSV contrast ratio; The contrast ratio of the element is obtained by weighted calculation based on the RGB contrast ratio and the HSV contrast ratio, and the calculation formula is: K=ω1×K RGB +ω2×K HSV Wherein, ω1 and ω2 are respectively the preset weights of the RGB contrast ratio and the HSV contrast ratio, and K is the contrast ratio; Determine whether the contrast ratio of the element obtained by weighted calculation is lower than a preset standard value, and if so, mark the element as an object that needs to be adjusted; When the contrast ratio of the element does not meet the preset standard value, a color adjustment strategy is formulated based on the contrast ratio of the corresponding element, wherein the color adjustment strategy includes a color adjustment direction, a color adjustment number, and a target color; Specifically include: Determining the direction to be adjusted according to the contrast ratio of the element to obtain a color adjustment direction, wherein the color adjustment direction includes increase and decrease; Calculating a color change amplitude based on the RGB color value and the HSV color value, and determining a color adjustment number based on the color change amplitude, wherein the color change amplitude includes an RGB color change distance and an HSV color change distance; The determination of the number of color adjustment times specifically includes the following steps: For the RGB color change distance, the calculation formula is: Among them, R1 and R2 are the red components of the foreground and background respectively, G1 and G2 are the green components of the foreground and background respectively, and B1 and B2 are the blue components of the foreground and background respectively; The calculation formula for the HSV color change distance is: Among them, H1 and H2 are the hues of the foreground and background respectively, S1 and S2 are the saturations of the foreground and background respectively, and V1 and V2 are the brightness of the foreground and background respectively; The calculation formula for the color change amplitude is: Where D is the color change amplitude; The color adjustment times are determined according to a preset segmented adjustment function, wherein the segmented adjustment function is: Wherein, D1 and D2 are preset thresholds, a, b, c and d are preset parameters, and n is the number of color adjustments; Calculating the RGB value of the target color according to the target brightness value, wherein the target brightness value is determined based on a preset standard value; In the color adjustment direction, the RGB color value of the corresponding element is progressively adjusted according to the color adjustment times until the RGB color value gradually transitions to the target color.
2. The method for dynamically adjusting an adaptive user interface according to claim 1, characterized in that: The RGB color value is converted to the HSV color value using the following formula: V = max(R, G, B); C = V-min(R, G, B); The calculation of H depends on the location of the maximum value, specifically: If V = R, then If V = G, then If V = B, then Among them, R is the red component in the RGB color value, G is the green component in the RGB color value, B is the blue component in the RGB color value, H is the hue in the HSV color value, V is the brightness in the HSV color value, S is the saturation in the HSV color value, and C is the color difference.
3. The method for dynamically adjusting an adaptive user interface according to claim 2, characterized in that: The step of calculating the RGB value of the target color according to the target brightness value, wherein the target brightness value is determined based on a preset standard value, includes: Determine a target brightness value based on a preset standard value; The brightness adjustment ratio q is calculated based on the target brightness value, and the calculation formula is: Among them, L t is the target brightness value; The RGB value of the target color is calculated according to the brightness adjustment ratio, and the calculation formula is: R new =R1×q G new =G1×q B new =B1×q。 4. The method for dynamically adjusting an adaptive user interface according to claim 3, characterized in that: The step of progressively adjusting the RGB color value of the corresponding element according to the number of color adjustments in the color adjustment direction until the RGB color value gradually transitions to the target color includes: Calculate the brightness change step size for each adjustment according to the color adjustment times and the target brightness value; In the color adjustment direction, the RGB value of the foreground is adjusted successively according to the color adjustment times and the step size of each adjustment until the RGB value of the target color is reached, wherein the RGB value adjustment formula of the foreground is: Among them, R new , G new and B new are the RGB values of the target color, ΔL is the brightness change step, and L1 is the brightness of the foreground RGB color value.
5. A dynamic adjustment system for an adaptive user interface, used to execute a dynamic adjustment method for an adaptive user interface as claimed in any one of claims 1 to 4, characterized in that: The dynamic adjustment system comprises: A color value extraction module is used to extract the RGB color values of the foreground and background of each element from the user interface, and convert the RGB color values of the foreground and background into corresponding HSV color values respectively; A contrast evaluation module, used to calculate the contrast ratio of the corresponding element based on the RGB color value and the HSV color value, and determine whether the contrast ratio of the element meets a preset standard value; An adjustment strategy formulation module, used for formulating a color adjustment strategy based on the contrast ratio of the corresponding element when the contrast ratio of the element does not meet the preset standard value, wherein the color adjustment strategy includes a color adjustment direction, a color adjustment number and a target color; The color adjustment module is used to progressively adjust the RGB color value of the corresponding element in the color adjustment direction according to the color adjustment times until the RGB color value gradually transitions to the target color.
Citation Information
Patent Citations
Method and device for adjusting object color, electronic equipment and computer storage medium
CN113157356A
Three-dimensional digital factory display picture rendering method based on HSV model
CN115937386A