Multi-theme management method and device based on SVG rendering, and network attached storage device

Through real-time detection and dynamic color mapping of SVG rendering method, the problems of insufficient flexibility and visual effects of mobile application theme management system are solved, and an efficient and personalized theme switching experience is achieved.

CN120631480APending Publication Date: 2025-09-12SHENZHEN GREEN CONNECTION TECH CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202510546539.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

In the existing technology, the flexibility of theme management systems for mobile applications is limited, making it difficult to achieve highly customized visual effects. In addition, the dynamic rendering capabilities of SVG are not effectively utilized, resulting in inefficient theme switching.

Method used

By detecting theme switching requirements in real time, building a color mapping table and performing preprocessing operations, including color conversion and sub-layer traversal, it dynamically maps SVG layer colors to achieve dynamic color replacement.

Benefits of technology

It improves the response speed and efficiency of theme switching, provides a smooth and diverse theme switching experience, and enhances the visual effects and personalized customization capabilities of the application interface.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631480A_ABST
    Figure CN120631480A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-theme management method and device based on SVG rendering and a network attached storage device, and the method comprises the steps: detecting a theme switching demand triggered for a target application in real time, and determining a to-be-switched theme corresponding to the theme switching demand; performing configuration file analysis and mapping table construction on the to-be-switched theme to obtain a corresponding color mapping table; according to a preset extension method, executing preprocessing operation on the SVG layer of the subject to be switched to obtain a corresponding preprocessing result; the preprocessing operation comprises color conversion operation and sub-layer traversal; and according to the color mapping table and a preset color replacement strategy, executing a dynamic color mapping operation on the preprocessing result so as to switch the current theme into the to-be-switched theme. Therefore, by implementing the method and the device, the flexibility and the efficiency of theme switching can be improved, and the response efficiency and the use fluency of the application are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of application theme switching, and in particular to a multi-theme management method and device based on SVG rendering, and a network attached storage device. Background Art

[0002] In mobile application development, user interface (UI) theme management is crucial for enhancing user experience and meeting personalized user needs. Traditional theme management systems rely primarily on loading static resources and simple color replacement mechanisms to implement theme switching. Specifically, these systems typically include a set of predefined color schemes and image resources that are loaded into memory upon application startup and remain fixed throughout the application's lifecycle. By selecting different theme options, users trigger the system to replace references to the preloaded resources, thereby changing the interface's appearance.

[0003] However, this system has numerous limitations. First, the static resource loading method limits the flexibility of theme switching. Adding or modifying themes requires recompiling and republishing the app, increasing maintenance costs and user update frequency. Second, the color replacement mechanism often only works on basic UI elements and lacks support for complex graphics, icons, or dynamic content, making it difficult to achieve highly customized visual effects.

[0004] Although SVG (Scalable Vector Graphics) has been used in mobile applications due to its advantages such as lossless scaling and small file size, existing SVG-based theme management focuses on static style switching and lacks effective utilization of its dynamic rendering capabilities. For example, it is unable to adjust graphic properties in real time based on user interaction, ambient lighting, or system status, which limits the application of SVG in building dynamic and responsive user interfaces. Summary of the Invention

[0005] The present invention provides a multi-theme management method and device based on SVG rendering, and a network attached storage device, which can improve the flexibility and efficiency of theme switching, as well as improve the response efficiency and usage fluency of applications.

[0006] In order to solve the above technical problems, the first aspect of the present invention discloses a multi-theme management method based on SVG rendering, the method comprising:

[0007] Real-time detection of a theme switching demand triggered by a target application, and determination of a theme to be switched corresponding to the theme switching demand; the theme switching demand is generated by triggering the selection of a theme package set on the target application;

[0008] Perform configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched;

[0009] According to a preset extension method, a preprocessing operation is performed on the SVG layer corresponding to the theme to be switched to obtain a preprocessing result corresponding to the SVG layer; the preprocessing operation includes a color conversion operation and a sub-layer traversal operation; the color conversion operation is used to convert the fill color corresponding to the SVG layer into a preset data format; the sub-layer traversal is used to determine all sub-layers in the SVG layer that need to be replaced;

[0010] According to the color mapping table and a predetermined color replacement strategy, a dynamic color mapping operation is performed on the preprocessing result to switch the current theme to the theme to be switched.

[0011] As an optional implementation, in the first aspect of the present invention, performing configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched includes:

[0012] According to a preset theme reset function, the to-be-switched theme and its corresponding to-be-switched theme package as well as the current theme of the target application and its corresponding initial theme package are loaded;

[0013] Parsing the first configuration file in the to-be-switched theme package and the second configuration file in the initial theme package according to the theme reset function to obtain first configuration information corresponding to the to-be-switched theme and second configuration information corresponding to the initial theme package;

[0014] A color mapping table is constructed according to the first configuration information and the second configuration information in a data storage manner of a dictionary structure.

[0015] As an optional embodiment, in the first aspect of the present invention, the color mapping table includes at least one mapping parameter; all of the mapping parameters include at least a theme color; all of the mapping parameters also include at least one other parameter selected from the group consisting of color transparency, color space, gradient color, pattern, stroke color, shadow color, and dynamic effects;

[0016] The first configuration information includes a color to be switched corresponding to the theme color; the second configuration information includes an initial color corresponding to the theme color; the color mapping table includes the color to be switched, the initial color, and a color mapping relationship between the color to be switched and the initial color;

[0017] The color mapping table also includes other mapping relationships; the other mapping relationships are mapping relationships between the to-be-switched theme and the initial theme corresponding to each of the other parameters.

[0018] As an optional implementation, in the first aspect of the present invention, performing a preprocessing operation on the SVG layer corresponding to the to-be-switched theme according to a preset extension method to obtain a preprocessing result corresponding to the SVG layer includes:

[0019] Performing a color conversion operation on the fill color in the SVG layer corresponding to the to-be-switched theme according to a preset color expansion method to obtain a color conversion result corresponding to the fill color; the color conversion operation is used to convert the fill color into a hexadecimal string format;

[0020] According to a preset layer expansion method, a recursive traversal operation is performed on all sublayers in the SVG layer corresponding to the theme to be switched, to obtain all target sublayers that need to perform color replacement;

[0021] The color conversion result and all the target sub-layers are determined as pre-processing results corresponding to the SVG layer.

[0022] As an optional embodiment, in the first aspect of the present invention, before performing a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched, the method further includes:

[0023] Determine a fill type corresponding to the to-be-switched theme; and determine a color replacement strategy for the to-be-switched theme based on the fill type; the color replacement strategy includes a first replacement strategy or a second replacement strategy; the first replacement strategy is a color replacement based on the color mapping table; the second replacement strategy is a forced color overlay based on a specified color;

[0024] The performing a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the to-be-switched theme includes:

[0025] When the color replacement strategy is the second replacement strategy, a forced color overwrite operation is performed on all the sub-layers that need to be replaced in the preprocessing result according to the color to be converted corresponding to the color conversion operation in the preprocessing result, so as to switch the current theme to the theme to be switched.

[0026] As an optional embodiment, in the first aspect of the present invention, performing a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the to-be-switched theme further includes:

[0027] When the color replacement strategy is the first replacement strategy, a color mapping relationship corresponding to the color to be converted and the initial color is determined from the color mapping table; the color to be converted is the color corresponding to the color conversion operation in the preprocessing result; and the initial color is the initial theme color corresponding to the current theme of the target application;

[0028] According to the color mapping relationship, a color mapping operation is performed on the current theme to update the initial theme color in the current theme to the color to be converted.

[0029] As an optional implementation, in the first aspect of the present invention, before performing configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched, the method further includes:

[0030] Detecting whether there is theme cache data corresponding to the to-be-switched theme in a preset cache database; the theme cache data includes parsed SVG layer data corresponding to the to-be-switched theme, and a stored color mapping table corresponding to the current theme of the target application and the to-be-switched theme;

[0031] When it is detected that the cache database contains theme cache data corresponding to the theme to be switched, the theme cache data is called, and a color mapping operation is performed on the current theme according to the stored color mapping table and the parsed SVG layer data and a predetermined color replacement strategy.

[0032] A second aspect of the present invention discloses a multi-theme management device based on SVG rendering, the device comprising:

[0033] A detection module, used to detect theme switching requirements triggered by target applications in real time;

[0034] A theme switching module is used to determine a theme to be switched corresponding to the theme switching requirement; the theme switching requirement is generated by triggering the selection of a theme package set on the target application;

[0035] A construction module, configured to perform configuration file parsing and mapping table construction on the theme to be switched, to obtain a color mapping table corresponding to the theme to be switched;

[0036] A preprocessing module is configured to perform a preprocessing operation on the SVG layer corresponding to the to-be-switched theme according to a preset expansion method, thereby obtaining a preprocessing result corresponding to the SVG layer; the preprocessing operation includes a color conversion operation and a sublayer traversal operation; the color conversion operation is configured to convert the fill color corresponding to the SVG layer into a preset data format; the sublayer traversal operation is configured to determine all sublayers in the SVG layer that need to be replaced;

[0037] A color mapping module is configured to perform a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy, so as to switch the current theme to the theme to be switched.

[0038] As an optional implementation, in the second aspect of the present invention, the construction module performs configuration file parsing and mapping table construction on the theme to be switched, and obtains a color mapping table corresponding to the theme to be switched, specifically including:

[0039] According to a preset theme reset function, the to-be-switched theme and its corresponding to-be-switched theme package as well as the current theme of the target application and its corresponding initial theme package are loaded;

[0040] Parsing the first configuration file in the to-be-switched theme package and the second configuration file in the initial theme package according to the theme reset function to obtain first configuration information corresponding to the to-be-switched theme and second configuration information corresponding to the initial theme package;

[0041] A color mapping table is constructed according to the first configuration information and the second configuration information in a data storage manner of a dictionary structure.

[0042] As an optional embodiment, in the second aspect of the present invention, the color mapping table includes at least one mapping parameter; all of the mapping parameters include at least a theme color; all of the mapping parameters also include at least one other parameter selected from the group consisting of color transparency, color space, gradient color, pattern, stroke color, shadow color, and dynamic effects;

[0043] The first configuration information includes a color to be switched corresponding to the theme color; the second configuration information includes an initial color corresponding to the theme color; the color mapping table includes the color to be switched, the initial color, and a color mapping relationship between the color to be switched and the initial color;

[0044] The color mapping table also includes other mapping relationships; the other mapping relationships are mapping relationships between the to-be-switched theme and the initial theme corresponding to each of the other parameters.

[0045] As an optional embodiment, in the second aspect of the present invention, the preprocessing module performs a preprocessing operation on the SVG layer corresponding to the to-be-switched theme according to a preset extension method, and a method of obtaining a preprocessing result corresponding to the SVG layer specifically includes:

[0046] Performing a color conversion operation on the fill color in the SVG layer corresponding to the to-be-switched theme according to a preset color expansion method to obtain a color conversion result corresponding to the fill color; the color conversion operation is used to convert the fill color into a hexadecimal string format;

[0047] According to a preset layer expansion method, a recursive traversal operation is performed on all sublayers in the SVG layer corresponding to the theme to be switched, to obtain all target sublayers that need to perform color replacement;

[0048] The color conversion result and all the target sub-layers are determined as pre-processing results corresponding to the SVG layer.

[0049] As an optional embodiment, in the second aspect of the present invention, the device further includes:

[0050] The determination module is further configured to perform a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy in the color mapping module, so as to determine a fill type corresponding to the theme to be switched before switching the current theme to the theme to be switched; and determine a color replacement strategy for the theme to be switched according to the fill type; the color replacement strategy includes a first replacement strategy or a second replacement strategy; the first replacement strategy is color replacement based on the color mapping table; the second replacement strategy is forced color coverage based on a specified color;

[0051] The color mapping module performs a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched, specifically including:

[0052] When the color replacement strategy is the second replacement strategy, a forced color overwrite operation is performed on all the sub-layers that need to be replaced in the preprocessing result according to the color to be converted corresponding to the color conversion operation in the preprocessing result, so as to switch the current theme to the theme to be switched.

[0053] As an optional embodiment, in the second aspect of the present invention, the color mapping module performs a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched, which specifically further includes:

[0054] When the color replacement strategy is the first replacement strategy, a color mapping relationship corresponding to the color to be converted and the initial color is determined from the color mapping table; the color to be converted is the color corresponding to the color conversion operation in the preprocessing result; and the initial color is the initial theme color corresponding to the current theme of the target application;

[0055] According to the color mapping relationship, a color mapping operation is performed on the current theme to update the initial theme color in the current theme to the color to be converted.

[0056] As an optional embodiment, in the second aspect of the present invention, the detection module is further configured to detect whether there is theme cache data corresponding to the theme to be switched in a preset cache database before the construction module performs configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched; the theme cache data includes parsed SVG layer data corresponding to the theme to be switched, the current theme of the target application, and a stored color mapping table corresponding to the theme to be switched;

[0057] The color mapping module is also used to call the theme cache data when it is detected that there is theme cache data corresponding to the theme to be switched in the cache database, and perform a color mapping operation on the current theme according to the stored color mapping table and the parsed SVG layer data and a predetermined color replacement strategy.

[0058] A third aspect of the present invention discloses a network-attached storage device, which is configured with a display screen and is used to interactively communicate with an electronic device, wherein the network-attached storage device is used to execute the multi-theme management method based on SVG rendering disclosed in the first aspect of the present invention.

[0059] A fourth aspect of the present invention discloses an electronic device, comprising:

[0060] a memory storing executable program code;

[0061] a processor coupled to the memory;

[0062] The processor calls the executable program code stored in the memory to execute the multi-theme management method based on SVG rendering disclosed in the first aspect of the present invention.

[0063] A fifth aspect of the present invention discloses a computer storage medium storing computer instructions. When the computer instructions are called, they are used to execute the multi-theme management method based on SVG rendering disclosed in the first aspect of the present invention.

[0064] A sixth aspect of the present invention discloses a multi-theme management system based on SVG rendering, the system comprising the multi-theme management device based on SVG rendering as disclosed in the second aspect of the present invention, and a network attached storage device in communication with the device; or

[0065] The system includes the electronic device disclosed in the fourth aspect of the present invention, and a network attached storage device communicatively connected to the electronic device.

[0066] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0067] In an embodiment of the present invention, a multi-theme management method based on SVG rendering is provided, which includes: real-time detection of a theme switching demand triggered for a target application, and determination of a theme to be switched corresponding to the theme switching demand; the theme switching demand is generated by triggering the selection of a theme package set on the target application; configuration file parsing and mapping table construction are performed on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched; according to a preset extension method, a preprocessing operation is performed on the SVG layer corresponding to the theme to be switched to obtain a preprocessing result corresponding to the SVG layer; the preprocessing operation includes a color conversion operation and a sub-layer traversal; the color conversion operation is used to convert the fill color corresponding to the SVG layer into a preset data format; the sub-layer traversal is used to determine all sub-layers that need to be replaced in the SVG layer; according to the color mapping table, a dynamic color mapping operation is performed on the preprocessing result in accordance with a predetermined color replacement strategy to switch the current theme to the theme to be switched. It can be seen that the implementation of the present invention, through a series of technical means such as real-time and accurate response to theme switching needs, efficient construction of color mapping relationships, optimization of SVG layer preprocessing, and realization of dynamic and accurate color mapping, makes it possible for the application to not need to reload a large amount of static resources when switching themes, thereby effectively improving the rendering efficiency required for theme switching, and then improving the response speed, accuracy and completeness of theme switching, providing users with a smoother and more diverse theme switching experience, while enhancing the visual effects and personalized customization capabilities of the application interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0069] Figure 1 This is a flowchart of a multi-theme management method based on SVG rendering disclosed in an embodiment of the present invention;

[0070] Figure 2 This is a flowchart of another multi-theme management method based on SVG rendering disclosed in an embodiment of the present invention;

[0071] Figure 3 This is a schematic diagram of the structure of a multi-theme management device based on SVG rendering disclosed in an embodiment of the present invention;

[0072] Figure 4 This is a schematic diagram of the structure of another multi-theme management device based on SVG rendering disclosed in an embodiment of the present invention;

[0073] Figure 5 It is a schematic diagram of the structure of a network attached storage device disclosed in an embodiment of the present invention;

[0074] Figure 6 This is a schematic structural diagram of an electronic device disclosed in an embodiment of the present invention;

[0075] Figure 7 This is a schematic diagram of the structure of a multi-theme management system based on SVG rendering disclosed in an embodiment of the present invention;

[0076] Figure 8 This is a structural diagram of another multi-theme management system based on SVG rendering disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0077] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0078] The terms "first," "second," and so on, in the description and claims of the present invention and the accompanying drawings are used to distinguish between different items, not to describe a specific order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or end comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed therein, or may optionally include other steps or elements inherent to such process, method, product, or end.

[0079] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0080] The present invention discloses a multi-theme management method and device based on SVG rendering, as well as a network-attached storage device. By implementing a series of technical measures, such as real-time and precise response to theme switching requirements, efficient construction of color mapping relationships, optimization of SVG layer preprocessing, and dynamic and precise color mapping, applications no longer need to reload large amounts of static resources when switching themes. This effectively improves the rendering efficiency required for theme switching, thereby increasing the response speed, accuracy, and completeness of theme switching, providing users with a smoother and more diverse theme switching experience, while also enhancing the visual effects and personalized customization capabilities of the application interface. These are described in detail below.

[0081] Example 1

[0082] See also Figure 1 , Figure 1 This is a flow chart of a multi-theme management method based on SVG rendering disclosed in an embodiment of the present invention. Figure 1 The multi-theme management method based on SVG rendering described above can be applied to a multi-theme management device based on SVG rendering, and the embodiment of the present invention does not limit this. Figure 1 As shown, the multi-theme management method based on SVG rendering may include the following operations:

[0083] 101. Detect in real time the theme switching demand triggered by the target application, and determine the theme to be switched corresponding to the theme switching demand.

[0084] In the embodiment of the present invention, the theme switching demand is generated by triggering the selection of a theme package set on the target application.

[0085] In an embodiment of the present invention, the theme switching demand can be actively triggered by the user. For example, a theme switching page of a target application is provided with multiple selectable themes. The user triggers one of the selectable themes, and the backend automatically generates a corresponding theme switching demand based on the user's selected target. Optionally, the theme switching demand can also be passively triggered, for example, based on a pre-set theme timed switching instruction, which is triggered at a specified time. This embodiment of the present invention is not limited to this.

[0086] In the embodiment of the present invention, it should be noted that when the theme switching demand is actively triggered by the user, the user actively triggering this operation can also be subdivided into a first operation type corresponding to the user selecting a pre-defined selectable theme, or a second operation type corresponding to the user triggering a theme custom function item to realize the personalized definition of the theme.

[0087] In the embodiment of the present invention, the method of determining the theme to be switched corresponding to the theme switching requirement in step 101 specifically includes:

[0088] When the operation is of the first type, the requirement details included in the theme switching requirement are determined, and based on the requirement details, a target theme matching the requirement details is determined from all stored selectable themes as the theme to be switched; wherein, generally, each stored selectable theme is stored in the form of a theme package;

[0089] When it is the second operation type, according to the theme switching requirement, the user's theme customization record is obtained; and according to the theme customization record, the user's currently generated customized theme is determined as the theme to be switched.

[0090] It can be seen that in the embodiment of the present invention, a response mechanism is provided for users to select other themes different from the current theme on the target application, and a response mechanism is also provided for the customized theme after the user customizes the theme; the setting of different theme switching mechanisms meets the personalized needs of users to customize theme colors, improves the flexibility and convenience of users in switching themes, and enhances the personalized experience and satisfaction of users in using the target application.

[0091] In an embodiment of the present invention, the real-time detection mechanism for theme switching needs ensures that the system can quickly capture the user's operational intention to change the theme style. No matter what scenario the user triggers the theme package selection, it can respond in a timely manner, laying an accurate foundation for the subsequent theme switching process, and avoiding switching errors or delays caused by inaccurate demand identification.

[0092] 102. Perform configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched.

[0093] In the embodiment of the present invention, the theme to be switched may actually be stored in the form of a theme package, and each theme includes a theme0.bundle / config.json configuration file, which defines the color mapping relationship.

[0094] In this embodiment of the present invention, this process presents the color information in the theme in a structured manner, making the color correspondence clear and unambiguous. In subsequent theme switching operations, the target color can be found quickly and accurately, greatly improving the efficiency and accuracy of color replacement and reducing switching errors caused by color information confusion.

[0095] 103. According to a preset extension method, a preprocessing operation is performed on the SVG layer corresponding to the theme to be switched, and a preprocessing result corresponding to the SVG layer is obtained.

[0096] In an embodiment of the present invention, the preprocessing operation includes a color conversion operation and a sub-layer traversal; the color conversion operation is used to convert the fill color corresponding to the SVG layer into a preset data format; this makes the color data easier to process and operate, providing convenience for subsequent color mapping.

[0097] In the embodiment of the present invention, sublayer traversal is used to determine all sublayers that need to be replaced in the SVG layer, ensuring that no elements that need to change color are missed during the theme switching process, thereby ensuring the integrity and consistency of the theme switching.

[0098] In an embodiment of the present invention, the SVG layer corresponding to the theme to be switched can be obtained by loading the theme resource package corresponding to the theme to be switched (that is, pre-cached), can be dynamically created and generated based on the theme to be switched, or can be extracted from the layer tree on the screen of the target application, and the embodiment of the present invention does not limit this.

[0099] 104. According to the color mapping table and a predetermined color replacement strategy, a dynamic color mapping operation is performed on the preprocessing result to switch the current theme to the theme to be switched.

[0100] It can be seen that implementation Figure 1 The described multi-theme management method based on SVG rendering, through a series of technical means such as real-time and accurate response to theme switching needs, efficient construction of color mapping relationships, optimization of SVG layer preprocessing, and implementation of dynamic and accurate color mapping, eliminates the need for applications to reload large amounts of static resources when switching themes. This can effectively improve the rendering efficiency required for theme switching, thereby improving the response speed, accuracy and completeness of theme switching, providing users with a smoother and more diverse theme switching experience, while enhancing the visual effects and personalized customization capabilities of the application interface.

[0101] In an optional embodiment, the above step 102 performs configuration file parsing and mapping table construction on the theme to be switched, and obtains a color mapping table corresponding to the theme to be switched, specifically including:

[0102] According to the preset theme reset function, load the theme to be switched and its corresponding theme package to be switched, as well as the current theme of the target application and its corresponding initial theme package;

[0103] According to the theme reset function, the first configuration file in the theme package to be switched and the second configuration file in the initial theme package are parsed to obtain the first configuration information corresponding to the theme to be switched and the second configuration information corresponding to the initial theme package;

[0104] A color mapping table is constructed according to the first configuration information and the second configuration information in a data storage manner of a dictionary structure.

[0105] In this optional embodiment, the color mapping table includes at least one mapping parameter; all mapping parameters include at least a theme color; all mapping parameters also include at least one other parameter of color transparency, color space, gradient color, pattern, stroke color, shadow color, and dynamic effect;

[0106] The first configuration information includes a color to be switched corresponding to the theme color; the second configuration information includes an initial color corresponding to the theme color; the color mapping table includes the color to be switched, the initial color, and a color mapping relationship between the color to be switched and the initial color;

[0107] The color mapping table also includes other mapping relationships; the other mapping relationships are mapping relationships between the to-be-switched theme and the initial theme corresponding to each other parameter.

[0108] In this optional embodiment, the theme reset function can use the _resetSelThemeBundle method. Subsequently, the theme reset function parses the first configuration file in the theme bundle to be switched and the second configuration file in the initial theme bundle, respectively, to obtain the first configuration information corresponding to the theme to be switched and the second configuration information corresponding to the initial theme bundle. This parsing method can quickly and accurately extract key configuration information from the theme, providing the necessary data support for the subsequent construction of the color mapping table, and improving the efficiency of theme switching preparation.

[0109] In this optional embodiment, the dictionary structure has efficient search and access characteristics, and can quickly obtain corresponding mapping relationships based on key-value pairs. This structured storage method makes the management and maintenance of the color mapping table more convenient and improves the efficiency of color mapping operations during theme switching.

[0110] In this optional embodiment, the constructed color mapping table covers not only the basic parameter of the conventional theme color, but also a number of other parameters. This comprehensive parameter coverage makes the theme switching not just a simple replacement of colors, but also enables all-round adjustment of the various visual effects of the theme, providing users with a richer and more delicate theme switching experience.

[0111] As can be seen, in this optional embodiment, by accurately loading theme resources, efficiently parsing configuration files, structurally constructing color mapping tables, comprehensively covering mapping parameters, clarifying color mapping relationships, and completely recording other mapping relationships, a more complete and accurate color mapping table can be constructed. This not only improves the efficiency and accuracy of theme switching, but also provides users with a richer, more detailed, and consistent theme switching experience, enhancing the visual effects and personalized customization capabilities of the application interface.

[0112] Example 2

[0113] See also Figure 2 , Figure 2 This is a flow chart of another multi-theme management method based on SVG rendering disclosed in an embodiment of the present invention. Figure 2 The multi-theme management method based on SVG rendering described above can be applied to a multi-theme management device based on SVG rendering, and the embodiment of the present invention does not limit this. Figure 2 As shown, the multi-theme management method based on SVG rendering may include the following operations:

[0114] 201. Detect in real time a theme switching demand triggered by a target application, and determine a theme to be switched corresponding to the theme switching demand.

[0115] 202. Perform configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched.

[0116] 203. Perform a color conversion operation on the fill color in the SVG layer corresponding to the theme to be switched according to a preset color expansion method to obtain a color conversion result corresponding to the fill color.

[0117] In an embodiment of the present invention, the color expansion method may utilize the toHexString() extension method of CGColor; this color conversion operation is used to convert the fill color into a hexadecimal string format. The hexadecimal string format is a universal and standardized color representation method widely used in computer graphics processing. This conversion provides a unified standard for color data, facilitating subsequent processing and calculations in operations such as color mapping and rendering, while avoiding compatibility issues or calculation errors caused by inconsistent color formats.

[0118] 204. According to a preset layer expansion method, a recursive traversal operation is performed on all sub-layers of the SVG layer corresponding to the theme to be switched, and all target sub-layers requiring color replacement are obtained.

[0119] In the embodiment of the present invention, the layer extension method may be the CALayer extension method applyOnSublayers and sublayers.

[0120] In this embodiment of the present invention, recursive traversal comprehensively and thoroughly examines every sublayer of an SVG layer, ensuring that no sublayer is missed. This traversal method accurately identifies all target sublayers requiring color replacement, ensuring that all elements requiring color change are correctly identified and processed during the theme switching process, thereby improving the completeness and accuracy of theme switching.

[0121] 205. The color conversion result and all target sub-layers are determined as pre-processing results corresponding to the SVG layer.

[0122] 206. According to the color mapping table and a predetermined color replacement strategy, a dynamic color mapping operation is performed on the preprocessing result to switch the current theme to the theme to be switched.

[0123] In the embodiment of the present invention, for other descriptions of steps 201-202 and step 206, please refer to other specific descriptions of steps 101-102 and step 104 in the first embodiment, which will not be repeated in the embodiment of the present invention.

[0124] It can be seen that implementation Figure 2 The described multi-theme management method based on SVG rendering performs preprocessing operations on SVG layers, such as color conversion and recursive sublayer traversal, and integrates the results into preprocessing results. This achieves standardized color data format, precise positioning of target sublayers, and efficient integration of preprocessing results. This not only improves the accuracy and efficiency of color processing during theme switching, but also ensures the integrity and consistency of theme switching.

[0125] In an optional embodiment, before performing a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched in step 206, the method further includes:

[0126] Determine the fill type corresponding to the theme to be switched; and determine the color replacement strategy for the theme to be switched based on the fill type; the color replacement strategy includes a first replacement strategy or a second replacement strategy; the first replacement strategy is color replacement based on a color mapping table; the second replacement strategy is forced color coverage based on a specified color;

[0127] The above step 206 performs a dynamic color mapping operation on the pre-processing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched, specifically including:

[0128] When the color replacement strategy is the second replacement strategy, according to the to-be-converted color corresponding to the color conversion operation in the preprocessing result, a forced color overwrite operation is performed on all sub-layers that need to be replaced in the preprocessing result to switch the current theme to the to-be-converted theme.

[0129] In this optional embodiment, when the preprocessing result also includes at least one other parameter of color transparency, color space, gradient color, pattern, stroke color, shadow color and dynamic effect, it is possible to perform a forced color overwrite operation on all sub-layers that need to be replaced in the preprocessing result according to the parameter values ​​corresponding to the other parameters to switch the current theme to the theme to be switched.

[0130] In this optional embodiment, the step of determining the filling type for the theme to be switched, and further determining the color replacement strategy based on the filling type, can fully consider the diverse filling requirements that may exist in different themes, and different filling types may correspond to different visual effects and expressions. By specifically determining the color replacement strategy, it can better adapt to various theme styles and ensure the accuracy and flexibility of theme switching.

[0131] In this optional embodiment, the first replacement strategy is applicable to most common situations and can perform accurate color replacement according to a pre-built color mapping table to ensure the consistency and accuracy of theme switching; the second replacement strategy provides solutions for some special situations. For example, when a mandatory color setting is required for a specific element, the second replacement strategy can be used to override the specified color, thereby increasing the flexibility and autonomy of theme switching.

[0132] In this optional embodiment, the setting of the second replacement strategy can directly modify the color of the target sublayer, avoiding complex mapping searches and calculations, and completing color replacement quickly and efficiently, ensuring to a certain extent the realization of rapid coverage requirements for specific color requirements and improving the efficiency of theme switching.

[0133] As can be seen, this optional embodiment achieves flexibility, accuracy, and efficiency in color replacement during theme switching by determining the color replacement strategy based on the fill type, providing a variety of replacement strategies based on color mapping tables and specified colors, and efficiently executing color replacement operations when a forced color override strategy is employed. This approach not only adapts to the fill requirements of different themes, but also provides users with personalized color customization, ensuring rapid theme switching, and improving the overall performance and user experience of multi-theme management based on SVG dynamic rendering.

[0134] In another optional embodiment, the above step 206 performs a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched, and specifically further includes:

[0135] When the color replacement strategy is the first replacement strategy, a color mapping relationship corresponding to the color to be converted and the initial color is determined from the color mapping table; the color to be converted is the color corresponding to the color conversion operation in the preprocessing result; the initial color is the initial theme color corresponding to the current theme of the target application;

[0136] Performs a color mapping operation on the current theme according to the color mapping relationship to update the initial theme colors in the current theme to the colors to be converted.

[0137] In this optional embodiment, when the mapping parameters corresponding to the color mapping table include other parameters in addition to the theme color, other parameter mapping operations are performed on the current theme according to the other mapping relationships to update the initial theme color in the current theme to the color to be converted;

[0138] The other mapping relationship is similar to the color mapping relationship. One side of the other mapping relationship is the initial theme parameter data corresponding to other parameters in the current theme; the other side is the to-be-switched theme parameter data corresponding to other parameters in the to-be-switched theme.

[0139] In this optional embodiment, after executing step 206 above, there will be at least two types of cache data related to the theme to be switched and its corresponding color mapping table. Correspondingly, the two types of cache data can be cached and recorded, so that when there is another theme switching requirement corresponding to the theme to be switched in the future, the cache data can be directly called, thereby reducing the amount of data calculation and improving the theme switching speed.

[0140] In this optional embodiment, by accurately matching the color to be converted with the initial color, it can be ensured that during the theme switching process, each color can find an accurate corresponding mapping relationship, avoiding confusion and errors during color replacement, and ensuring the accuracy and consistency of color replacement.

[0141] In this optional embodiment, the first replacement strategy based on the color mapping table can smoothly transition colors during the theme switching process, avoiding sudden color changes or inconsistencies.

[0142] It can be seen that in this optional embodiment, when adopting the first replacement strategy, by accurately matching the color mapping relationship and efficiently mapping and updating the colors based on the relationship, it is beneficial to improve the accuracy and consistency of color replacement during the theme switching process; at the same time, the use of this color mapping table facilitates the management and maintenance of the system, and improves the flexibility and stability of multi-theme management based on SVG rendering.

[0143] In yet another optional embodiment, the method further includes:

[0144] After determining the theme to be switched corresponding to the theme switching requirement, it is determined whether the false trigger condition is currently satisfied. If it is determined that the false trigger condition is not currently satisfied, the above step 102 is triggered to perform configuration file parsing and mapping table construction on the switchable theme to obtain an operation corresponding to the color mapping table corresponding to the switchable theme;

[0145] When it is determined that the false trigger condition is currently met, the color replacement strategy is determined to be a third replacement strategy; the third replacement strategy is used to indicate that the color of the SVG remains unchanged;

[0146] performing a theme maintenance operation on the target application according to a third replacement strategy;

[0147] Furthermore, the above-mentioned method of determining whether the false trigger condition is currently met specifically includes:

[0148] Comparing the theme to be switched with the current theme of the target application to obtain a theme difference result between the theme to be switched and the current theme of the target application;

[0149] When the theme difference result indicates that the theme to be switched is completely consistent with the current theme, an error operation confirmation message for the theme switching requirement is generated, and the error operation confirmation message is fed back to the trigger object corresponding to the theme switching requirement, so as to confirm to the trigger object whether the theme switching requirement is an error operation and prompt that the theme to be switched is consistent with the current theme;

[0150] When receiving secondary confirmation information of the operation fed back by the triggering object in response to the erroneous operation confirmation information, determining information details of the secondary confirmation information of the operation, the information details including a first detail indicating that the theme switching request is not an erroneous operation, or a second detail opposite to the first detail;

[0151] When the information detail is the first detail, it is determined that the false trigger condition is currently satisfied; when the information detail is the second detail, it is determined that the false trigger condition is currently not satisfied.

[0152] It can be seen that in this optional embodiment, a false trigger judgment mechanism is set up for the theme switching demand, and a response mechanism for different judgment results is set up, so that when the user selects the wrong theme when switching themes (the selected theme to be switched is the same as the current theme), the false trigger notification and confirmation can be carried out in time; for the case where the false trigger conditions are met, the current theme color can also be maintained unchanged based on the third replacement strategy according to the set response process; the theme switching process is further improved to avoid the situation where the application is stuck and errors are reported due to user misoperation; and the use stability and reliability of the target application are improved.

[0153] In another optional embodiment, before the step 202 performs configuration file parsing and mapping table construction on the theme to be switched to obtain the color mapping table corresponding to the theme to be switched, the method further includes:

[0154] Checking whether there is theme cache data corresponding to the theme to be switched in a preset cache database; the theme cache data includes parsed SVG layer data corresponding to the theme to be switched, and a stored color mapping table corresponding to the current theme of the target application and the theme to be switched;

[0155] When it is detected that the cache database contains theme cache data corresponding to the theme to be switched, the theme cache data is called, and a color mapping operation is performed on the current theme according to a predetermined color replacement strategy based on the stored color mapping table and the parsed SVG layer data.

[0156] In this optional embodiment, the method of directly calling the theme cache data can reduce unnecessary calculation and processing steps, for example, avoiding repeated configuration file parsing and mapping table construction work, which is beneficial to reducing the system CPU and memory utilization and improving the overall theme switching speed; in addition, the stored theme cache data is generally verified and stored, which can ensure that consistent color mapping rules and layer information are used during the theme switching process, avoiding the problem of color mapping inconsistencies or layer information errors that may exist due to each re-parsing and construction, and ensuring that the theme style after switching is consistent with expectations.

[0157] It can be seen that in this optional embodiment, by detecting the cache database and calling the theme cache data before executing the configuration file parsing and mapping table construction, that is, the rendering of SVG layer data and the real-time construction of the color mapping table are relatively directly performed, by detecting and calling the existing theme cache data, redundant / repeated calculations are reduced, and the efficiency of theme switching is greatly improved.

[0158] Example 3

[0159] See also Figure 3 , Figure 3This is a structural diagram of a multi-theme management device based on SVG rendering disclosed in an embodiment of the present invention. This multi-theme management device based on SVG rendering can be applied to a multi-theme management method based on SVG rendering. Figure 3 As shown, the multi-theme management device based on SVG rendering may include a detection module 301, a theme switching module 302, a construction module 303, a pre-processing module 304 and a color mapping module 305, wherein:

[0160] The detection module 301 is used to detect the theme switching demand triggered by the target application in real time.

[0161] The theme switching module 302 is used to determine a theme to be switched corresponding to a theme switching requirement; the theme switching requirement is generated by triggering a theme package set on a target application.

[0162] The construction module 303 is used to perform configuration file parsing and mapping table construction on the theme to be switched, and obtain a color mapping table corresponding to the theme to be switched.

[0163] The preprocessing module 304 is used to perform a preprocessing operation on the SVG layer corresponding to the theme to be switched according to a preset extension method to obtain a preprocessing result corresponding to the SVG layer; the preprocessing operation includes a color conversion operation and a sub-layer traversal; the color conversion operation is used to convert the fill color corresponding to the SVG layer into a preset data format; the sub-layer traversal is used to determine all sub-layers that need to be replaced in the SVG layer.

[0164] The color mapping module 305 is configured to perform a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy, so as to switch the current theme to the theme to be switched.

[0165] It can be seen that implementation Figure 3 The described multi-theme management device based on SVG rendering, through a series of technical means such as real-time and accurate response to theme switching needs, efficient construction of color mapping relationships, optimization of SVG layer preprocessing, and realization of dynamic and accurate color mapping, eliminates the need for applications to reload a large amount of static resources when switching themes, thereby effectively improving the rendering efficiency required for theme switching, and further improving the response speed, accuracy and completeness of theme switching, providing users with a smoother and more diverse theme switching experience, while enhancing the visual effects and personalized customization capabilities of the application interface.

[0166] In an optional embodiment, the construction module 303 performs configuration file parsing and mapping table construction on the to-be-switched theme, and obtains a color mapping table corresponding to the to-be-switched theme in the following manner:

[0167] According to the preset theme reset function, load the theme to be switched and its corresponding theme package to be switched, as well as the current theme of the target application and its corresponding initial theme package;

[0168] According to the theme reset function, the first configuration file in the theme package to be switched and the second configuration file in the initial theme package are parsed to obtain the first configuration information corresponding to the theme to be switched and the second configuration information corresponding to the initial theme package;

[0169] A color mapping table is constructed according to the first configuration information and the second configuration information in a data storage manner of a dictionary structure.

[0170] In this optional embodiment, the color mapping table includes at least one mapping parameter; all mapping parameters include at least a theme color; all mapping parameters also include at least one other parameter of color transparency, color space, gradient color, pattern, stroke color, shadow color, and dynamic effect;

[0171] The first configuration information includes a color to be switched corresponding to the theme color; the second configuration information includes an initial color corresponding to the theme color; the color mapping table includes the color to be switched, the initial color, and a color mapping relationship between the color to be switched and the initial color;

[0172] The color mapping table also includes other mapping relationships; the other mapping relationships are mapping relationships between the to-be-switched theme and the initial theme corresponding to each other parameter.

[0173] As can be seen, in this optional embodiment, by accurately loading theme resources, efficiently parsing configuration files, structurally constructing color mapping tables, comprehensively covering mapping parameters, clarifying color mapping relationships, and completely recording other mapping relationships, a more complete and accurate color mapping table can be constructed. This not only improves the efficiency and accuracy of theme switching, but also provides users with a richer, more detailed, and consistent theme switching experience, enhancing the visual effects and personalized customization capabilities of the application interface.

[0174] In another optional embodiment, the preprocessing module 304 performs a preprocessing operation on the SVG layer corresponding to the theme to be switched according to a preset extension method, and obtains the preprocessing result corresponding to the SVG layer in the following manner:

[0175] According to a preset color expansion method, a color conversion operation is performed on the fill color of the SVG layer corresponding to the theme to be switched, to obtain a color conversion result corresponding to the fill color; the color conversion operation is used to convert the fill color into a hexadecimal string format;

[0176] According to the preset layer expansion method, recursively traverse all sublayers of the SVG layer corresponding to the theme to be switched, and obtain all target sublayers that need to perform color replacement;

[0177] The color conversion result and all target sublayers are determined as pre-processing results corresponding to the SVG layer.

[0178] As can be seen, in this optional embodiment, by performing preprocessing operations such as color conversion and recursive sublayer traversal on the SVG layer and integrating the results into the preprocessing result, a standardized color data format is achieved, the target sublayer is accurately located, and the preprocessing results are efficiently integrated. This not only improves the accuracy and efficiency of color processing during the theme switching process, but also ensures the integrity and consistency of the theme switching.

[0179] In yet another alternative embodiment, see Figure 4 , Figure 4 This is a schematic diagram of the structure of another multi-theme management device based on SVG rendering disclosed in an embodiment of the present invention. Figure 4 As shown, the apparatus further includes a determination module 306, wherein:

[0180] The determination module 306 is further configured to, before the color mapping module 305 performs a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched, determine the fill type corresponding to the theme to be switched; and determine the color replacement strategy for the theme to be switched according to the fill type; the color replacement strategy includes a first replacement strategy or a second replacement strategy; the first replacement strategy is color replacement based on the color mapping table; the second replacement strategy is forced color overwriting based on a specified color;

[0181] The color mapping module 305 performs a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy, so as to switch the current theme to the theme to be switched. Specifically, the method includes:

[0182] When the color replacement strategy is the second replacement strategy, according to the to-be-converted color corresponding to the color conversion operation in the preprocessing result, a forced color overwrite operation is performed on all sub-layers that need to be replaced in the preprocessing result to switch the current theme to the to-be-converted theme.

[0183] As can be seen, this optional embodiment achieves flexibility, accuracy, and efficiency in color replacement during theme switching by determining the color replacement strategy based on the fill type, providing a variety of replacement strategies based on color mapping tables and specified colors, and efficiently executing color replacement operations when a forced color override strategy is employed. This approach not only adapts to the fill requirements of different themes, but also provides users with personalized color customization, ensuring rapid theme switching, and improving the overall performance and user experience of multi-theme management based on SVG dynamic rendering.

[0184] In another optional embodiment, the color mapping module 305 performs a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched, and specifically further includes:

[0185] When the color replacement strategy is the first replacement strategy, a color mapping relationship corresponding to the color to be converted and the initial color is determined from the color mapping table; the color to be converted is the color corresponding to the color conversion operation in the preprocessing result; the initial color is the initial theme color corresponding to the current theme of the target application;

[0186] Performs a color mapping operation on the current theme according to the color mapping relationship to update the initial theme colors in the current theme to the colors to be converted.

[0187] It can be seen that in this optional embodiment, when adopting the first replacement strategy, by accurately matching the color mapping relationship and efficiently mapping and updating the colors based on the relationship, it is beneficial to improve the accuracy and consistency of color replacement during the theme switching process; at the same time, the use of this color mapping table facilitates the management and maintenance of the system, and improves the flexibility and stability of multi-theme management based on SVG rendering.

[0188] In another optional embodiment, the detection module 301 is further configured to detect whether there is theme cache data corresponding to the theme to be switched in a preset cache database before the construction module 303 performs configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched; the theme cache data includes parsed SVG layer data corresponding to the theme to be switched, and stored color mapping tables corresponding to the current theme of the target application and the theme to be switched;

[0189] The color mapping module 305 is also used to call the theme cache data when it is detected that there is theme cache data corresponding to the theme to be switched in the cache database, and perform color mapping operations on the current theme according to the stored color mapping table and the parsed SVG layer data and a predetermined color replacement strategy.

[0190] It can be seen that in this optional embodiment, by detecting the cache database and calling the theme cache data before executing the configuration file parsing and mapping table construction, that is, the rendering of SVG layer data and the real-time construction of the color mapping table are relatively directly performed, by detecting and calling the existing theme cache data, redundant / repeated calculations are reduced, and the efficiency of theme switching is greatly improved.

[0191] Example 4

[0192] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of a network attached storage device disclosed in an embodiment of the present invention. Figure 5 As shown, the network attached storage device is configured with a display screen, and the network attached storage device is used to interactively communicate with the electronic device, wherein the network attached storage device is used to execute the steps of the multi-theme management method based on SVG rendering described in Example 1 or Example 2 of the present invention.

[0193] In an embodiment of the present invention, the network-attached storage device is dedicated to storing network data and is capable of uploading, centrally storing, sharing data, backing up, and restoring interactive data generated when executing the steps of the multi-theme management method based on SVG rendering described in Embodiment 1 or Embodiment 2 of the present invention. The network-attached storage device can also support multimedia services. The interactive data includes the above-mentioned text to be processed, the first data processing result, the second data processing result, the third data processing result, and the target rich text data.

[0194] Example 5

[0195] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. Figure 6 As shown, the electronic device may include:

[0196] A memory 401 storing executable program code;

[0197] a processor 402 coupled to the memory 401;

[0198] The processor 402 calls the executable program code stored in the memory 401 to execute the steps of the multi-theme management method based on SVG rendering described in the first embodiment of the present invention or the second embodiment of the present invention.

[0199] Example 6

[0200] An embodiment of the present invention discloses a computer storage medium storing computer instructions. When the computer instructions are called, they are used to execute the steps of the multi-theme management method based on SVG rendering described in the first embodiment or the second embodiment of the present invention.

[0201] Example 7

[0202] See also Figure 7 , Figure 7 This is a schematic diagram of the structure of a multi-theme management system based on SVG rendering disclosed in an embodiment of the present invention. Figure 7 As shown, the system includes the multi-theme management device based on SVG rendering as disclosed in the third embodiment of the present invention, and a network attached storage device in communication with the device; or,

[0203] See also Figure 8 , Figure 8 This is a schematic diagram of another multi-theme management system based on SVG rendering disclosed in an embodiment of the present invention. Figure 8 As shown, the system includes the electronic device disclosed in the fifth embodiment of the present invention, and a network attached storage device communicatively connected to the electronic device.

[0204] Example 6

[0205] An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer storage medium storing a computer program, and the computer program is operable to cause a computer to execute the steps of the multi-theme management method based on SVG rendering described in Example 1 or Example 2.

[0206] The device embodiments described above are merely illustrative. Modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0207] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, or of course, by means of hardware. Based on this understanding, the above technical solution, in essence, or the portion that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer storage medium, including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.

[0208] Finally, it should be noted that the multi-theme management method and apparatus based on SVG rendering and the network attached storage device disclosed in the embodiments of the present invention are only preferred embodiments of the present invention, and are only used to illustrate the technical solutions of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A multi-theme management method based on SVG rendering, characterized in that: The method comprises: Real-time detection of a theme switching demand triggered by a target application, and determination of a theme to be switched corresponding to the theme switching demand; the theme switching demand is generated by triggering the selection of a theme package set on the target application; Perform configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched; According to a preset extension method, a preprocessing operation is performed on the SVG layer corresponding to the theme to be switched to obtain a preprocessing result corresponding to the SVG layer; the preprocessing operation includes a color conversion operation and a sub-layer traversal operation; the color conversion operation is used to convert the fill color corresponding to the SVG layer into a preset data format; the sub-layer traversal is used to determine all sub-layers in the SVG layer that need to be replaced; According to the color mapping table and a predetermined color replacement strategy, a dynamic color mapping operation is performed on the preprocessing result to switch the current theme to the theme to be switched.

2. The multi-theme management method based on SVG rendering according to claim 1, characterized in that: The performing of configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched includes: According to a preset theme reset function, the to-be-switched theme and its corresponding to-be-switched theme package as well as the current theme of the target application and its corresponding initial theme package are loaded; Parsing the first configuration file in the to-be-switched theme package and the second configuration file in the initial theme package according to the theme reset function to obtain first configuration information corresponding to the to-be-switched theme and second configuration information corresponding to the initial theme package; A color mapping table is constructed according to the first configuration information and the second configuration information in a data storage manner of a dictionary structure.

3. The multi-theme management method based on SVG rendering according to claim 2, characterized in that: The color mapping table includes at least one mapping parameter; all the mapping parameters include at least a theme color; all the mapping parameters also include at least one other parameter of color transparency, color space, gradient color, pattern, stroke color, shadow color, and dynamic effect; The first configuration information includes a color to be switched corresponding to the theme color; the second configuration information includes an initial color corresponding to the theme color; the color mapping table includes the color to be switched, the initial color, and a color mapping relationship between the color to be switched and the initial color; The color mapping table also includes other mapping relationships; the other mapping relationships are mapping relationships between the to-be-switched theme and the initial theme corresponding to each of the other parameters.

4. The multi-theme management method based on SVG rendering according to any one of claims 1 to 3, characterized in that: The step of performing a preprocessing operation on the SVG layer corresponding to the to-be-switched theme according to a preset extension method to obtain a preprocessing result corresponding to the SVG layer includes: Performing a color conversion operation on the fill color in the SVG layer corresponding to the to-be-switched theme according to a preset color expansion method to obtain a color conversion result corresponding to the fill color; the color conversion operation is used to convert the fill color into a hexadecimal string format; According to a preset layer expansion method, a recursive traversal operation is performed on all sublayers in the SVG layer corresponding to the theme to be switched, to obtain all target sublayers that need to perform color replacement; The color conversion result and all the target sub-layers are determined as pre-processing results corresponding to the SVG layer.

5. The multi-theme management method based on SVG rendering according to any one of claims 1 to 3, characterized in that: Before performing a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched, the method further includes: Determine a fill type corresponding to the to-be-switched theme; and determine a color replacement strategy for the to-be-switched theme based on the fill type; the color replacement strategy includes a first replacement strategy or a second replacement strategy; the first replacement strategy is a color replacement based on the color mapping table; the second replacement strategy is a forced color overlay based on a specified color; The performing a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the to-be-switched theme includes: When the color replacement strategy is the second replacement strategy, a forced color overwrite operation is performed on all the sub-layers that need to be replaced in the preprocessing result according to the color to be converted corresponding to the color conversion operation in the preprocessing result, so as to switch the current theme to the theme to be switched.

6. The multi-theme management method based on SVG rendering according to claim 5, characterized in that: The method further includes performing a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy to switch the current theme to the theme to be switched. When the color replacement strategy is the first replacement strategy, a color mapping relationship corresponding to the color to be converted and the initial color is determined from the color mapping table; the color to be converted is the color corresponding to the color conversion operation in the preprocessing result; and the initial color is the initial theme color corresponding to the current theme of the target application; According to the color mapping relationship, a color mapping operation is performed on the current theme to update the initial theme color in the current theme to the color to be converted.

7. The multi-theme management method based on SVG rendering according to claim 1, 2, 3 or 6, characterized in that: Before performing configuration file parsing and mapping table construction on the theme to be switched to obtain a color mapping table corresponding to the theme to be switched, the method further includes: Detecting whether there is theme cache data corresponding to the to-be-switched theme in a preset cache database; the theme cache data includes parsed SVG layer data corresponding to the to-be-switched theme, and a stored color mapping table corresponding to the current theme of the target application and the to-be-switched theme; When it is detected that the cache database contains theme cache data corresponding to the theme to be switched, the theme cache data is called, and a color mapping operation is performed on the current theme according to the stored color mapping table and the parsed SVG layer data and a predetermined color replacement strategy.

8. A multi-theme management device based on SVG rendering, characterized in that: The device comprises: A detection module, used to detect theme switching requirements triggered by target applications in real time; A theme switching module is used to determine a theme to be switched corresponding to the theme switching requirement; the theme switching requirement is generated by triggering the selection of a theme package set on the target application; A construction module, configured to perform configuration file parsing and mapping table construction on the theme to be switched, to obtain a color mapping table corresponding to the theme to be switched; A preprocessing module, configured to perform a preprocessing operation on the SVG layer corresponding to the to-be-switched theme according to a preset extension method, and obtain a preprocessing result corresponding to the SVG layer; the preprocessing operation includes a color conversion operation and a sublayer traversal operation; the color conversion operation is configured to convert the fill color corresponding to the SVG layer into a preset data format; the sublayer traversal is configured to determine all sublayers in the SVG layer that need to be replaced; A color mapping module is configured to perform a dynamic color mapping operation on the preprocessing result according to the color mapping table and a predetermined color replacement strategy, so as to switch the current theme to the theme to be switched.

9. A network attached storage device, characterized in that: The network attached storage device is configured with a display screen, and the network attached storage device is used to interactively communicate with an electronic device, wherein the network attached storage device is used to execute the multi-theme management method based on SVG rendering according to any one of claims 1-7.

10. An electronic device, characterized in that: The electronic device includes: a memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the multi-theme management method based on SVG rendering according to any one of claims 1 to 7.

11. A computer storage medium, characterized in that The computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the multi-theme management method based on SVG rendering according to any one of claims 1 to 7.

12. A multi-theme management system based on SVG rendering, characterized in that: The system comprises the multi-theme management device based on SVG rendering as claimed in claim 8, and a network attached storage device communicatively connected to the device; or The system comprises the electronic device according to claim 10 and a network attached storage device communicatively connected to the electronic device.

Citation Information

Patent Citations

  • Method and device for theme replacement of mobile device

    CN103942037A

  • Page color theme switching method and device, storage medium and electronic equipment

    CN111078221A

  • Interface theme switching method and device, equipment, storage medium and program product

    CN113076150A

  • Component-based dynamic theme generation method, device and equipment

    CN115033815A

  • Front-end page color adjusting method, device and system and medium

    CN115587272A