Webpage theme setting method and device dynamically following desktop wallpaper color

Through the web theme setting method that dynamically follows the color of desktop wallpaper, color recognition and network proxy technology are used to realize dynamic synchronization of web themes and desktop wallpaper colors, solving the limitations of application scope and personalized customization in the existing technology, and providing an intelligent and personalized browsing experience.

CN120196828APending Publication Date: 2025-06-24FUJIAN TQ ONLINE INTERACTIVE INC
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311783592.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-22
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The existing technology can only realize the personalized setting of web themes on the IE browser, and requires users to predefined web themes, limiting their application scope and freedom of personalized customization.

Method used

The web theme setting method that dynamically follows the color of the desktop wallpaper is used, and the main color of the desktop wallpaper is calculated through the color recognition algorithm. The browser request is intercepted by the network agent, the theme color is generated according to the color matching algorithm, and the desktop wallpaper changes are monitored in real time, and the web theme is automatically adjusted.

Benefits of technology

It realizes dynamic synchronization of web themes and desktop wallpaper colors, providing users with an intelligent and personalized browsing experience, suitable for various browsers, and avoids the hassle of manually adjusting browser themes by users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196828A_ABST
    Figure CN120196828A_ABST
Patent Text Reader

Abstract

The invention relates to a webpage theme setting method and device dynamically following the desktop wallpaper color. The method comprises the steps that 1, the main color of current desktop wallpaper is calculated through a color recognition algorithm; 2, starting network proxy setting, intercepting a network request of a browser when any webpage is opened, sending the network request to a remote server by using a network request library, and obtaining the webpage returned by the server; 3, generating a theme color according to a color matching algorithm in combination with the main color; 4, the webpage theme of the webpage returned by the server is set by using the generated theme color, and the modified webpage is sent back to the browser to be displayed; 5, changes of the desktop wallpaper are monitored in real time, once the desktop wallpaper changes, the changed desktop wallpaper is intercepted, the steps 1-4 are executed, and the webpage theme is modified.The method and device can be applied to various browsers, the webpage theme can be adjusted in real time, and the personalized browsing experience of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and particularly to a method and device for setting a web page theme that dynamically follows the color of the desktop wallpaper. Background Art

[0002] For example, a method for personalized replacement of web page themes with the publication number CN1987854A proposes a new way for improving the personalized settings of web pages and the download speed of web pages. This method uses the BHO technology provided by IE to monitor the events of processing messages inside IE. After the CSS files in the web page are obtained by IE and before these CSS files are processed, the locally predefined web page theme is used for replacement. The result is a completely personalized web page theme. Users can modify the style of the web page theme according to their own wishes, and can arbitrarily set the color, font, loaded files, pictures, etc. of the web page theme. All items related to the theme can be modified. Since the custom theme file comes from the local hard disk, the time for network transmission is eliminated, so the speed of downloading web pages is very fast, and the speed of users browsing web pages is improved.

[0003] However, it has significant application scope limitations and is only applicable to the IE browser and cannot be applied to other browsers. In addition, this method requires users to predefined web page themes locally, so there are certain limitations in terms of personalized customization.

[0004] Therefore, a more widely applicable method for replacing web page themes is needed, which can be applied to various browsers on computers and mobile phones, and can instantaneously adjust the web page theme to enhance the personalized browsing experience of users. Summary of the Invention

[0005] To overcome the above problems, the purpose of the present invention is to provide a method and device for setting a web page theme that dynamically follows the color of the desktop wallpaper, which can be applied to various browsers on computers and mobile phones, can instantaneously adjust the web page theme, and can enhance the personalized browsing experience of users.

[0006] The present invention is implemented by the following scheme:

[0007] A method for setting a web page theme that dynamically follows the color of the desktop wallpaper, the steps of the method are as follows:

[0008] Step 1: Calculate the main color of the current desktop wallpaper through a color recognition algorithm;

[0009] Step 2: Start the network proxy setting. When any web page is opened, intercept the network request of the browser, use the network request library to send a network request to the remote server, and obtain the web page returned by the server;

[0010] Step 3: Generate a theme color according to the color matching algorithm in combination with the main color;

[0011] Step 4: Use the generated theme color to set the web page theme of the web page returned by the server, and send the modified web page back to the browser for display;

[0012] Step 5: Monitor the desktop wallpaper change in real time. Once the desktop wallpaper changes, capture the changed desktop wallpaper and execute Steps 1 to 4 to modify the web page theme.

[0013] Further, Step 1 is further specifically: calculating the dominant color of the current desktop wallpaper through a color recognition algorithm, where the color recognition algorithm is the K-Means clustering algorithm, and extracting the dominant color of the desktop wallpaper through the K-Means clustering algorithm.

[0014] Further, Step 3 is further specifically: the dominant color C main is represented in RGB format as C main =(R main , G main , B main )

[0015] where R main , G main and B main respectively represent the R, G, and B components of the dominant color;

[0016] Calculate the complementary color C main of the dominant color C complement , and the calculation method is as follows:

[0017] C complement =(255 - R main , 255 - G main , 255 - Bx ain )

[0018] After obtaining the complementary color C complement , traverse each HTML tag of the web page to obtain the corresponding tag color C element ,

[0019] Introduce adjustment coefficients α, β, γ to obtain the theme color C adjust , and the theme color C adjust is specifically as follows:

[0020] C adjust =α·C element +β·C complement +γ·C main .

[0021] Further, step 4 is further specifically as follows: Obtain the theme color, traverse each HTML tag of the web page, apply the adjusted color to each HTML tag, and send the modified web page back to the browser for display.

[0022] Further, step 5 is further specifically as follows: On the Windows operating system, obtain the path of the current desktop wallpaper through the GetWallpaper method, set the interval time each time, regularly obtain the path of the current desktop wallpaper according to the interval time and compare it with the path obtained last time. If the path of the desktop wallpaper is the same, it has not changed and steps 1-4 are not executed. If the path of the desktop wallpaper is different, it means that the desktop wallpaper has changed. At this time, steps 1-4 are executed again, and the web page theme is modified according to the changed desktop wallpaper.

[0023] A web page theme setting device that dynamically follows the color of the desktop wallpaper, the device includes: a color picking module, a proxy module, a color matching module, a modification module, and a monitoring module;

[0024] The color picking module is used to calculate the main color of the current desktop wallpaper through a color recognition algorithm;

[0025] The proxy module is used to start the network proxy setting. When opening any web page, intercept the network request of the browser, send a network request to the remote server using the network request library, obtain the web page returned by the server, and pass the web page to the color matching module for modification;

[0026] The color matching module is used to obtain the main color of the color picking module and generate a theme color by combining the main color according to the color matching algorithm;

[0027] The modification module is used to modify the web page theme according to the theme color generated by the color matching module and send the modified web page back to the browser for display;

[0028] The monitoring module is used to monitor the change of the desktop wallpaper in real time. When the desktop wallpaper changes, intercept the changed desktop wallpaper and sequentially execute the color picking module, the proxy module, the color matching module, and the modification module to modify the web page theme.

[0029] Further, in the color picking module, it is further specifically as follows: The main color of the current desktop wallpaper is calculated through the color recognition algorithm, where the color recognition algorithm is the K-Means clustering algorithm, and the main color of the desktop wallpaper is extracted through the K-Means clustering algorithm.

[0030] Further, the color matching module is further specifically as follows: The main color C main Expressed in RGB format as

[0031] C main =(R main ,Gmain , B main )

[0032] Wherein, R main , G main and B main respectively represent the R, G, and B components of the main color;

[0033] Calculate the complementary color C main of the main color C complement , and the calculation method is as follows:

[0034] C complement = (255 - R main , 255 - G main , 255 - B main )

[0035] After obtaining the complementary color C complement , traverse each HTML tag of the web page to obtain the corresponding tag color C element ,

[0036] Introduce adjustment coefficients α, β, γ to obtain the theme color C adjust , and the theme color C adjust is specifically as follows:

[0037] C adjust = α·C ekement + β·C compkement + γ·C main .

[0038] Furthermore, the modification module is further specifically: obtain the theme color, traverse each HTML tag of the web page, apply the adjusted color to each HTML tag, and send the modified web page back to the browser for display.

[0039] Furthermore, the monitoring module is further specifically: on the Windows operating system, obtain the path of the current desktop wallpaper through the GetWallpaper method, set the interval time each time, regularly obtain the path of the current desktop wallpaper according to the interval time and compare it with the path obtained last time. If the path of the desktop wallpaper is the same, it has not changed, then no operation is performed. If the path of the desktop wallpaper is different, it means that the desktop wallpaper has changed, then the color sampling module, proxy module, color matching module, and modification module are executed in sequence to modify the web page theme according to the changed desktop wallpaper.

[0040] The beneficial effects of the present invention are as follows:

[0041] The present invention provides a method and device for setting a web page theme that dynamically follows the color of the desktop wallpaper, realizing the dynamic synchronization of the web page theme and the color of the desktop wallpaper, and providing users with an intelligent and personalized browsing experience.

[0042] The color extraction module calculates the main color; the proxy module is responsible for proxying browser requests and passing the color information to the color matching module; the color matching module uses a color matching algorithm to generate a theme color scheme that coordinates with the desktop wallpaper, ensuring a harmonious color combination between the browser theme and the desktop wallpaper; the modification module modifies the web page theme according to the theme colors generated by the color matching module and sends the modified web page back to the browser for display; the monitoring module monitors in real time when the user changes the desktop wallpaper. When the desktop wallpaper changes, it calls each of the other modules to modify the web page theme; this intelligent synchronization mechanism eliminates the trouble of users manually adjusting the browser theme and improves the convenience of the user experience. Brief Description of the Drawings

[0043] Figure 1 is a flowchart of the method of the present invention;

[0044] Figure 2 is a structural block diagram of the device of the present invention. Detailed Embodiments

[0045] The present invention will be further described below with reference to the accompanying drawings.

[0046] See Figure 1 , a method for setting a web page theme that dynamically follows the color of the desktop wallpaper, the method steps are as follows:

[0047] Step 1: Calculate the main color of the current desktop wallpaper through a color recognition algorithm;

[0048] Step 2: Start network proxy settings. When any web page is opened, intercept the network request of the browser, use the network request library to send a network request to the remote server, and obtain the web page returned by the server;

[0049] Step 3: Generate theme colors according to the color matching algorithm in combination with the main color;

[0050] Step 4: Use the generated theme colors to set the web page theme of the web page returned by the server, and send the modified web page back to the browser for display;

[0051] Step 5: Monitor the change of the desktop wallpaper in real time. Once the desktop wallpaper changes, intercept the changed desktop wallpaper, and execute Steps 1 to 4 to modify the web page theme. The present invention will be further described below with a specific embodiment:

[0052] A method for setting a web page theme that dynamically follows the color of the desktop wallpaper, the method includes the following steps:

[0053] Step 1: Extract the main color C of the current desktop wallpaper through the K-Means clustering algorithm main ;

[0054] Step 2: Start the network proxy settings. When the user opens any web page through the browser, intercept the network request of the browser, use the network request library to send a network request to the remote server, and obtain the web page returned by the server. At this time, the theme color of the web page can be modified;

[0055] Step 3: First, use the main color C main as the basis for the web page theme color matching. The main color C main is represented in RGB format as

[0056] C main =(R main , G main , B main )

[0057] where R main , G main and B main respectively represent the R, G, and B components of the main color;

[0058] Then calculate the complementary color C main of the main color C complement . The calculation method is as follows:

[0059] C complement =(255 - R main , 255 - G main , 255 - B main )

[0060] After obtaining the complementary color C complement , traverse each HTML tag of the web page to obtain the corresponding tag color C element . There are mainly three styles for HTML tags: inline style, embedded style, and external style. Their priority relationship is inline style > embedded style > external style. When traversing the web page tags, the styles applied to them can be found by checking the style and class attributes. Through the priority relationship of these styles, the final color used by the tag can be determined.

[0061] Introduce adjustment coefficients α, β, γ to obtain the theme color C adjust . The theme color C adjust is specifically as follows:

[0062] C adjust =α·C element +β·C complement +γ·C main .

[0063] By fine-tuning the values of α, β, and γ, the algorithm can adjust the color requirements of different web page tags, providing users with a more personalized theme color scheme. The fine-tuning process is based on a series of predefined color matching rules, rather than manual parameter adjustment by the user. Different fine-tuning values are preset according to the characteristics of each web page tag to ensure a sense of hierarchy in the overall color scheme. For example, for the title tag, a more saturated color may be used to highlight and emphasize; while for the body content, it may be fine-tuned to a softer color to maintain the overall balance.

[0064] Step 4: Obtain the theme color C adjust After that, traverse each HTML tag of the web page and apply the adjusted color C adjust to each HTML tag and send the modified web page back to the browser for display

[0065] Step 5: On the Windows operating system, obtain the path of the current desktop wallpaper through the GetWallpaper method, detect the change of the desktop wallpaper in real time, set the interval time each time, regularly obtain the path of the current desktop wallpaper according to the interval time and compare it with the path obtained last time. If the path of the desktop wallpaper is the same, it has not changed; if the path of the desktop wallpaper is different, it means that the desktop wallpaper has changed; when it is detected that the path of the current desktop wallpaper is different from the previous path, execute Steps 1-4 again to modify the web page theme.

[0066] See Figure 2 , a device for setting a web page theme that dynamically follows the color of the desktop wallpaper, the device includes: a color extraction module, a proxy module, a color matching module, a modification module, and a monitoring module;

[0067] The color extraction module is used to calculate the main color of the current desktop wallpaper through a color recognition algorithm;

[0068] The proxy module is used to start network proxy settings. When opening any web page, intercept the network request of the browser, send a network request to the remote server using the network request library, obtain the web page returned by the server, and pass the web page to the color matching module for modification;

[0069] The color matching module is used to obtain the main color of the color extraction module and generate a theme color in combination with the main color according to the color matching algorithm;

[0070] The modification module is used to modify the web page theme according to the theme color generated by the color matching module and send the modified web page back to the browser for display;

[0071] The monitoring module is used to monitor the change of the desktop wallpaper in real time. When the desktop wallpaper changes, intercept the changed desktop wallpaper and sequentially execute the color extraction module, the proxy module, the color matching module, and the modification module to modify the web page theme.

[0072] In one embodiment of the present invention, the color sampling module is further specifically: calculating the main color of the current desktop wallpaper through a color recognition algorithm, where the color recognition algorithm is the K-Means clustering algorithm, and extracting the main color of the desktop wallpaper through the K-Means clustering algorithm.

[0073] In one embodiment of the present invention, the color matching module is further specifically: the main color C main represented in RGB format as

[0074] C main =(R main , G main , B main ).

[0075] where R main , G main and B main respectively represent the R, G, and B components of the main color;

[0076] Then calculate the complementary color C main of the main color C complement , and the calculation method is as follows:

[0077] C complement =(255 - R main , 255 - G main , 255 - B main ).

[0078] After obtaining the complementary color C complement , traverse each HTML tag of the web page to obtain the corresponding tag color C element ,

[0079] Introduce adjustment coefficients α, β, γ to obtain the theme color C adjust , and the theme color C adjust is specifically as follows:

[0080] C adjust =α·C element +β·C complement +γ·C main .

[0081] Based on the previous embodiment, the modification module is further specifically: obtaining the theme color, traversing each HTML tag of the web page, applying the adjusted color to each HTML tag, and sending the modified web page back to the browser for display.

[0082] In one embodiment of the present invention, the monitoring module is further specifically: on the Windows operating system, obtain the path of the current desktop wallpaper through the GetWallpaper method, set the interval time each time, regularly obtain the path of the desktop wallpaper according to the interval time and compare it with the previously obtained path. If the path of the desktop wallpaper is the same, it means no change has occurred, and there is no operation. If the path of the desktop wallpaper is different, it means the desktop wallpaper has changed. Then, the color extraction module, proxy module, color matching module, and modification module are executed in sequence to modify the web page theme according to the changed desktop wallpaper.

[0083] One embodiment of the present invention is as follows:

[0084] In the early morning, the user sets the desktop to a bright orange and light blue sunrise landscape wallpaper. Then, the device of the present invention is started. The proxy module starts to listen for network proxy requests on port 8080 of the local machine. At the same time, the color extraction module extracts and calculates the main color of the desktop wallpaper. The user sets the network proxy of the browser to port 8080 of the local machine, and then starts the browser and opens website A. The proxy module detects the network request to access website A, requests the content of website A from the remote server, and hands it over to the color matching module for processing. The color matching module modifies the color values of each label in the website through an algorithm according to the main color provided by the color extraction module, generating a bright and warm theme with orange as the keynote, which complements the sunrise desktop wallpaper. The modification module returns the modified web page content to the browser, enabling the user to see that the theme color of website A is very close to the desktop color, presenting a harmonious color combination.

[0085] In the evening, the user sets the desktop wallpaper to a dark blue and purple starry sky or night scene, and accesses website B through the browser. The monitoring module of the device recognizes the change in the desktop wallpaper, detects the request to access website B, and then modifies the theme of website B into a deep and peaceful color scheme, which is coordinated with the night desktop wallpaper.

[0086] In summary, the present invention provides a method and device for setting a web page theme that dynamically follows the color of the desktop wallpaper, realizing the dynamic synchronization of the web page theme and the color of the desktop wallpaper, and providing an intelligent and personalized browsing experience for users.

[0087] The above are only the preferred embodiments of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention shall fall within the scope covered by the present invention.

Claims

1. A method for setting a web page theme that dynamically follows the color of the desktop wallpaper, characterized in that, The method steps are as follows: Step 1: Calculate the dominant color of the current desktop wallpaper through a color recognition algorithm; Step 2: Start the network proxy setting. When any web page is opened, intercept the network request of the browser, use the network request library to send a network request to the remote server, and obtain the web page returned by the server; Step 3: Generate a theme color according to the color matching algorithm combined with the dominant color; Step 4: Use the generated theme color to set the web page theme of the web page returned by the server, and send the modified web page back to the browser for display; Step 5: Monitor the change of the desktop wallpaper in real time. Once the desktop wallpaper changes, capture the changed desktop wallpaper, and execute Steps 1 to 4 to modify the web page theme.

2. The method for setting a web page theme that dynamically follows the color of the desktop wallpaper according to claim 1, wherein, Step 1 is further specifically: The dominant color of the current desktop wallpaper is calculated through the color recognition algorithm. Among them, the color recognition algorithm is the K-Means clustering algorithm, and the dominant color of the desktop wallpaper is extracted through the K-Means clustering algorithm.

3. A method for setting a web page theme that dynamically follows the color of the desktop wallpaper according to claim 1, characterized in that, Step 3 is further specifically as follows: primary color C main represented in the RGB format as C main = (R main , G main , B main ) Among them, R main , G main and B main respectively represent the R, G, and B components of the main color; Calculate the main color C main and its complementary color C complement The calculation method is as follows: C complement = (255 - R main , 255 - G main , 255 - B main ) Obtain complementary color C complement After that, traverse each HTML tag of the web page to obtain the corresponding tag color C element , Introduce adjustment coefficients α, β, γ to obtain the theme color C adjust , the theme color C adjust Specifically, the formula is as follows: C adjust = α·C element + β·C complement + γ·C main .

4. A method for setting a web page theme that dynamically follows the color of the desktop wallpaper according to claim 3, characterized in that, Step 4 is further specifically as follows: Obtain the theme color C adjust After that, traverse each HTML tag of the web page, and apply the adjusted color C adjust to each HTML tag, and send the modified web page back to the browser for display.

5. A method for setting a web page theme that dynamically follows the color of the desktop wallpaper according to claim 1, characterized in that, Step 5 is further specifically: On the Windows operating system, obtain the path of the current desktop wallpaper through the GetWallpaper method, set the interval time each time, regularly obtain the path of the current desktop wallpaper according to the interval time and compare it with the path obtained last time. If the paths of the desktop wallpapers are the same, it means no change has occurred, and Steps 1-4 are not executed. If the paths of the desktop wallpapers are different, it means the desktop wallpaper has changed. At this time, execute Steps 1-4 again to modify the web page theme according to the changed desktop wallpaper.

6. A web page theme setting device that dynamically follows the color of the desktop wallpaper, characterized in that, The device includes: a color extraction module, a proxy module, a color matching module, a modification module, and a monitoring module; The color extraction module is used to calculate the dominant color of the current desktop wallpaper through a color recognition algorithm; The proxy module is used to start the network proxy setting. When any web page is opened, intercept the network request of the browser, use the network request library to send a network request to the remote server, obtain the web page returned by the server, and pass the web page to the color matching module for modification; The color matching module is used to obtain the dominant color of the color extraction module and generate a theme color according to the color matching algorithm combined with the dominant color; The modification module is used to set the web page theme of the web page returned by the server according to the theme color generated by the color matching module, and send the modified web page back to the browser for display; The monitoring module is used to monitor the change of the desktop wallpaper in real time. When the desktop wallpaper changes, capture the changed desktop wallpaper and sequentially execute the color extraction module, the proxy module, the color matching module, and the modification module to modify the web page theme.

7. The web page theme setting device for dynamically following the color of the desktop wallpaper according to claim 6, wherein In the color extraction module, it is further specifically: The dominant color of the current desktop wallpaper is calculated through the color recognition algorithm. Among them, the color recognition algorithm is the K-Means clustering algorithm, and the dominant color of the desktop wallpaper is extracted through the K-Means clustering algorithm.

8. The web page theme setting device for dynamically following the color of the desktop wallpaper according to claim 6, characterized in that, The color matching module is further specifically: main color C main Expressed in RGB format as C main = (R main , G main , B main ) Among them, R main , G main and B main respectively represent the R, G, and B components of the main color; Calculate the main color C main 's complementary color C complement , the calculation method is as follows: C complement = (255 - R main , 255 - G main , 255 - B main ) Obtain complementary color C complement After that, traverse each HTML tag on the web page to obtain the corresponding tag color C element , Introduce adjustment coefficients α, β, γ to obtain the theme color C adjust , the theme color C adjust Specifically, the formula is as follows: C adjust = α·C element + β·C complement + γ·C main 。 9. The web page theme setting device for dynamically following the color of the desktop wallpaper according to claim 8, characterized in that, The modification module is further specifically: obtaining the theme color C adjust After that, traverse each HTML tag of the web page, and apply the adjusted color C adjust to each HTML tag, and send the modified web page back to the browser for display.

10. The web page theme setting device for dynamically following the color of the desktop wallpaper according to claim 6, wherein Specifically, the monitoring module is further configured as follows: on the Windows operating system, the path of the current desktop wallpaper is obtained through the GetWallpaper method, and an interval time is set. According to the interval time, the path of the current desktop wallpaper is regularly obtained and compared with the path obtained last time. If the path of the desktop wallpaper remains the same, it means no change has occurred, and no operation is performed. If the path of the desktop wallpaper is inconsistent, it indicates that the desktop wallpaper has changed. In this case, the color picking module, proxy module, color matching module, and modification module are executed in sequence to modify the web page theme according to the changed desktop wallpaper.

Citation Information

Patent Citations

  • Method for personalized replacing webpage subject

    CN1987854A