Page theme customization method and device, electronic equipment and storage medium
By constructing a theme variable file for the page theme and configuring basic styles using a pre-compiler, the problem of insufficient flexibility in page theme customization of existing component libraries is solved. This enables dynamic style loading of business source files in the running browser, improving customization efficiency and flexibility.
Patent Information
- Application Number
- CN202111546585.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-16
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2041-12-16
AI Technical Summary
Existing component libraries lack flexibility in page theme customization, leading to maintenance difficulties and code redundancy, especially when switching between multiple themes, making it difficult to achieve flexible style customization.
By constructing a theme variable file for the page theme, configuring basic styles using a pre-compiler, generating a theme style file, and matching the business theme styles of the business source files from the theme style file, the browser is dynamically loaded and displayed to achieve the loading and display of the theme styles of the business source files.
It improves the flexibility of page theme customization, reduces business code redundancy, and increases the efficiency and flexibility of generating business theme styles.
Smart Images

Figure CN114185522B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of page development, and more particularly to a method, apparatus, electronic device, and computer-readable storage medium for customizing page themes. Background Technology
[0002] The component library is general-purpose, but a single visual no longer meets user experience needs. To improve user experience, enhance application reputation, and increase developer efficiency, developers want the component library to be customizable, providing skinning functionality and style customization for various types of components. This would allow the application to switch to different theme styles based on user or business needs, and also allow style modifications to specific components.
[0003] There are many mature component libraries available online, all of which have the ability to customize themes, such as Element-UI, Ant Design, iView, and Ionic. However, they all have issues with performance or inflexibility. For example, rewriting class names requires implementing multiple style variable files when there are multiple themes, which makes maintenance difficult and leads to code redundancy, resulting in a lack of flexibility in customizing page themes. Although the improved Modify Vars theme component can support flexible use during compilation or runtime, it increases the size of the compiled CSS file because it needs to import the source file first and then rewrite a set of style replacements during compilation. At runtime, it can only change variables in the linked LESS file, and LESS variables are only valid in the current file and cannot be reused by other pages, which also leads to a lack of flexibility in customizing page themes. Summary of the Invention
[0004] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for customizing page themes, the main purpose of which is to improve the flexibility of page theme customization.
[0005] To achieve the above objectives, the present invention provides a method for customizing page themes, comprising:
[0006] Based on the customization requirements of the page theme, construct the theme variables of the page theme, and generate the theme variable file of the page theme based on the theme variables;
[0007] The basic style of the theme variables in the theme variable file is configured using a preset pre-compiler, and a theme style file for the theme variable file is generated based on the basic style.
[0008] Receive the business source file, match the business theme style of the business source file with the theme style file, and generate the running style file of the business source file according to the business theme style;
[0009] The running style file is loaded into a preset running browser to obtain the page theme style of the business source file.
[0010] Optionally, constructing the theme variables of the page theme according to the customization requirements of the page theme includes:
[0011] Based on the customization requirements, the theme type of the page theme is identified, and the page theme is coded according to the theme type to obtain the theme variable of the page theme.
[0012] Optionally, generating the theme variable file for the page theme based on the theme variables includes:
[0013] Obtain the compilation environment for the theme variables, define the variable form of each variable in the theme variables in the compilation environment, and generate the theme variable file for the page theme based on the variable form.
[0014] Optionally, the step of configuring the basic styles of the theme variables in the theme variable file using a preset pre-compiler to obtain a theme style file includes:
[0015] The preset pre-compiler is used to declare the topic sequence of the topic variables in the topic variable file, and the structure style of the topic variables in the topic variable file is set.
[0016] The structure style is converted into an encoded variable, and the encoded variable is loaded into the topic sequence to obtain the basic style of the topic variables in the topic variable file.
[0017] Optionally, loading the business theme style of the business source file from the theme style file includes:
[0018] Obtain the business theme and theme style requirements of the business source file, and read the basic theme style of the business theme from the theme style file;
[0019] Based on the theme style requirements, the business theme style of the business theme is read from the basic theme style.
[0020] Optionally, generating the runtime style file of the business source file based on the business theme style includes:
[0021] Obtain the business theme of the business theme style in the business source file, and identify the position sequence of the business theme style in the business source file based on the business theme;
[0022] Based on the position sequence, the business theme style is loaded into the business source file to obtain the running style file of the business source file.
[0023] Optionally, before loading the business theme style of the business source file from the theme style file, the method further includes:
[0024] Obtain the browser version of the browser running the business source file, and determine whether the theme style file is compatible with the browser running the business source file based on the browser version;
[0025] If the theme style file is incompatible with the running browser, then configure a compatibility plugin for the theme style file and the running browser.
[0026] To address the above problems, the present invention also provides a page theme customization device, the device comprising:
[0027] The theme variable file generation module is used to construct theme variables for the page theme according to the customization requirements of the page theme, and generate the theme variable file for the page theme based on the theme variables;
[0028] The theme style file generation module is used to configure the basic style of the theme variables in the theme variable file using a preset pre-compiler, and generate the theme style file of the theme variable file based on the basic style;
[0029] The running style file generation module is used to receive the business source file, match the business theme style of the business source file from the theme style file, and generate the running style file of the business source file according to the business theme style.
[0030] The page theme style generation module is used to load the running style file into a preset running browser to obtain the page theme style of the business source file.
[0031] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:
[0032] At least one processor; and,
[0033] A memory communicatively connected to the at least one processor; wherein,
[0034] The memory stores a computer program that can be executed by the at least one processor to implement the page theme customization method described above.
[0035] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing at least one computer program, which is executed by a processor in an electronic device to implement the page theme customization method described above.
[0036] As can be seen, by constructing theme variables for the page theme to generate a theme variable file, this embodiment of the invention can flexibly maintain and replace variables of the business theme, improving the efficiency of subsequent business theme customization. Furthermore, by configuring the basic styles of the theme variables in the theme variable file to generate a theme style file, the basic styles of the theme variables can be dynamically applied, improving the flexibility of page theme customization and further enhancing the efficiency of subsequent business theme customization. Secondly, by matching the business theme styles of the business source file from the theme style file to generate a runtime style file for the business source file, this embodiment of the invention can achieve style loading and display of the business source file in the running browser, enabling dynamic application of the theme styles of the business source file, reducing redundancy in the business code of the business source file, and improving the flexibility of generating business theme styles for the business source file. Therefore, the page theme customization method, apparatus, electronic device, and computer-readable storage medium proposed in this embodiment of the invention can improve the flexibility of page theme customization. Attached Figure Description
[0037] Figure 1 A flowchart illustrating a page theme customization method according to an embodiment of the present invention;
[0038] Figure 2 This is a schematic diagram of a page theme customization device provided in an embodiment of the present invention;
[0039] Figure 3 A schematic diagram of the internal structure of an electronic device that implements a page theme customization method according to an embodiment of the present invention;
[0040] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0041] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0042] This invention provides a method for customizing page themes. The execution subject of this method includes, but is not limited to, at least one of the following: a server, a terminal, or other electronic devices configured to execute the method provided in this invention. In other words, the page theme customization method can be executed by software or hardware installed on a terminal device or a server device, and the software may be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cluster of cloud servers. The server can be an independent server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0043] Reference Figure 1 The diagram shown is a flowchart illustrating a page theme customization method according to an embodiment of the present invention. In this embodiment, the page theme customization method includes:
[0044] S1. Based on the customization requirements of the page theme, construct the theme variables of the page theme, and generate the theme variable file of the page theme based on the theme variables.
[0045] In this embodiment of the invention, the page theme refers to the page theme elements that need to be displayed on the front-end page, such as page icons, navigation bars, search bars, text boxes, etc. The customization requirements refer to business requirements that automate the configuration of page themes, generated based on different user needs. For example, user A needs to customize the themes of text boxes and page images, while user B needs to customize the themes of the navigation bar and search bar. The theme variable refers to the theme form that the page theme exists in the compilation environment, used to display the page theme on the front-end page. Therefore, this embodiment of the invention constructs the theme variable of the page theme according to the customization requirements of the page theme to ensure the prerequisite for subsequent automated customization of business themes.
[0046] As an embodiment of the present invention, constructing the theme variable of the page theme according to the customization requirements of the page theme includes: identifying the theme type of the page theme according to the customization requirements, and encoding the page theme according to the theme type to obtain the theme variable of the page theme.
[0047] The theme type refers to the theme category of the page theme, which is used to identify the theme identity information of the page theme. The theme encoding includes the sequence encoding and annotation encoding of the page theme. The sequence encoding is used to represent the sequence position of each theme in the page theme, and the annotation encoding is used to represent the theme description information of each theme in the page theme. Optionally, the theme type is identified through the description information of the customized requirements, and the theme encoding is implemented through a preset theme encoding script, which can be implemented using JavaScript.
[0048] Furthermore, in this embodiment of the invention, a theme variable file for the page theme is generated based on the theme variables to summarize the theme variables existing in the page theme, facilitating quick retrieval of subsequent theme variables and improving the efficiency of subsequent business theme customization.
[0049] As an embodiment of the present invention, generating the theme variable file of the page theme based on the theme variables includes: obtaining the compilation environment of the theme variables, defining the variable form of each variable in the theme variables in the compilation environment, and generating the theme variable file of the page theme based on the variable forms. Here, the compilation environment refers to the source code compilation environment of the theme variables, such as the Sublime compilation environment; the variable form refers to the code form of each variable in the theme variables, which is defined using the CSS language; and the theme variable file refers to the code variable file formed by the page theme in the compilation environment, and its file format includes .css format.
[0050] S2. Configure the basic style of the theme variables in the theme variable file using the preset pre-compiler, and generate the theme style file of the theme variable file according to the basic style.
[0051] It should be understood that the theme variables in the theme variable file only determine the theme information of the page theme and do not include the structural style of each theme in the page theme. The basic styles include color, font size, rounded corners, and dynamics, etc. Furthermore, it should be understood that CSS files do not support custom variable settings. Therefore, this embodiment of the invention configures the basic styles of the theme variables in the theme variable file using a pre-compiler to obtain the display style of the theme variables in the theme variable file on the front-end page, enabling the dynamic integration of the basic styles of the theme variables and improving the customization flexibility of the page theme. Optionally, the pre-compiler includes the Less compiler.
[0052] As an embodiment of the present invention, the step of configuring the basic style of the theme variables in the theme variable file using a preset pre-compiler to obtain a theme style file includes: declaring the theme sequence of the theme variables in the theme variable file using the preset pre-compiler, setting the structural style of the theme variables in the theme variable file, converting the structural style into encoded variables, and loading the encoded variables into the theme sequence to obtain the basic style of the theme variables in the theme variable file.
[0053] The theme sequence includes the variable position and variable name of the theme variable, which is set through the root method in the pre-compiler. The structure style refers to the theme style contained in the theme variable, which is set based on different business requirements, such as setting the color to yellow, red, black and white, and the rounded corners to full rounded corners, half rounded corners, etc. The encoding vector conversion of the structure style is implemented through the style conversion table, such as white can be converted to #ffffff.
[0054] Furthermore, in this embodiment of the invention, a theme style file is generated from the theme variable file based on the basic style, thereby summarizing the theme styles existing in the theme variable file. This facilitates quick retrieval of subsequent theme styles and further improves the efficiency of subsequent business theme customization. The generation process of the theme style file is the same as the generation process of the theme variable file described above, and will not be elaborated further here.
[0055] Furthermore, to ensure the privacy and reusability of the theme style file, the theme style file can also be stored in a blockchain node.
[0056] S3. Receive the business source file, match the business theme style of the business source file with the theme style file, and generate the running style file of the business source file according to the business theme style.
[0057] In this embodiment of the invention, the business source file refers to the file that needs to generate page theme styles in actual business scenarios. Therefore, this embodiment of the invention loads the business theme style of the business source file into the theme style file to achieve dynamic input of the theme style of the business source file, reduce the redundancy of business code in the business source file, and improve the generation flexibility of the business theme style of the business source file.
[0058] In an optional embodiment of the present invention, before loading the business theme style of the business source file from the theme style file, the method further includes: obtaining the browser version of the browser corresponding to the business source file; determining, based on the browser version, whether the theme style file is compatible with the browser running the business source file; and configuring a compatibility plugin between the theme style file and the browser running the business source file if the theme style file is incompatible with the browser running the business source file, to ensure that the business source file can be loaded and displayed normally in the browser running the business source file, thereby achieving the stability of the business source file running in the browser running the business source file. Here, the browser running the business source file refers to the loading medium that runs the business source file, such as Internet Explorer, Google Chrome, etc.
[0059] As an embodiment of the present invention, loading the business theme style of the business source file from the theme style file includes: obtaining the business theme and theme style requirements of the business source file; reading the basic theme style of the business theme from the theme style file; and reading the business theme style of the business theme from the basic theme style according to the theme style requirements. Here, the business theme refers to the theme in the business source file that satisfies the business scenario, and the theme style requirements refer to the business style of the business theme in the business source file that satisfies the business scenario. Optionally, the basic theme style and the business theme style are implemented using a reading function, such as the var() function.
[0060] Furthermore, in this embodiment of the invention, a running style file for the business source file is generated based on the business theme style, so as to obtain the loading file of the business source file in the subsequent running browser, thereby realizing the loading, running and style display of the business source file.
[0061] As an embodiment of the present invention, generating the runtime style file of the business source file based on the business theme style includes: obtaining the business theme of the business theme style in the business source file; identifying the position sequence of the business theme style in the business source file based on the business theme; and loading the business theme style into the business source file according to the position sequence to obtain the runtime style file of the business source file. The loading of the business theme style is implemented using a style compilation language, such as CSS.
[0062] S4. Load the running style file into the preset running browser to obtain the page theme style of the business source file.
[0063] In this embodiment of the invention, the preset running browser refers to a browser compatible with the running style file. Further, this embodiment of the invention loads the running style file into the preset running browser to obtain the page display style of the business source file. Optionally, the loading of the running style file is implemented using HTML technology.
[0064] As can be seen, this embodiment of the invention, by constructing theme variables for the page theme to generate a theme variable file, can flexibly maintain and replace variables of the business theme, improving the efficiency of subsequent business theme customization. Furthermore, by configuring the basic styles of the theme variables in the theme variable file to generate a theme style file, the basic styles of the theme variables can be dynamically applied, improving the flexibility of page theme customization and further enhancing the efficiency of subsequent business theme customization. Secondly, this embodiment of the invention, by matching the business theme styles of the business source file from the theme style file to generate a runtime style file for the business source file, can achieve style loading and display of the business source file in the running browser, enabling dynamic application of the theme styles of the business source file, reducing redundancy in the business code of the business source file, and improving the flexibility of generating business theme styles for the business source file. Therefore, the page theme customization method proposed in this embodiment of the invention can improve the flexibility of page theme customization.
[0065] like Figure 2 The diagram shown is a functional block diagram of the page theme customization device of the present invention.
[0066] The page theme customization device 100 of this invention can be installed in an electronic device. Depending on the functions implemented, the page theme customization device may include a theme variable file generation module 101, a theme style file generation module 102, a running style file generation module 103, and a page theme style generation module 104. The module described in this invention can also be called a unit, referring to a series of computer program segments that can be executed by the processor of an electronic device and perform a fixed function, stored in the memory of the electronic device.
[0067] In this embodiment, the functions of each module / unit are as follows:
[0068] The theme variable file generation module 101 is used to construct theme variables for the page theme according to the customization requirements of the page theme, and generate a theme variable file for the page theme based on the theme variables.
[0069] The theme style file generation module 102 is used to configure the basic style of the theme variables in the theme variable file using a preset pre-compiler, and generate the theme style file of the theme variable file according to the basic style.
[0070] The runtime style file generation module 103 is used to receive the business source file, match the business theme style of the business source file from the theme style file, and generate the runtime style file of the business source file according to the business theme style.
[0071] The page theme style generation module 104 is used to load the running style file into a preset running browser to obtain the page theme style of the business source file.
[0072] In detail, the modules in the page theme customization device 100 described in this embodiment of the invention employ the same methods as described above during use. Figure 1 The page theme customization method described herein uses the same technical means and can produce the same technical effect, so it will not be repeated here.
[0073] like Figure 3 The diagram shown is a structural schematic of the electronic device 1 that implements the page theme customization method of the present invention.
[0074] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13. It may also include a computer program, such as a page theme customization program, stored in the memory 11 and capable of running on the processor 10.
[0075] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device 1, connecting various components of the electronic device 1 through various interfaces and lines. It executes programs or modules stored in the memory 11 (e.g., executing page theme customization programs) and calls data stored in the memory 11 to perform various functions and process data of the electronic device 1.
[0076] The memory 11 includes at least one type of readable storage medium, including flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a portable hard drive of the electronic device 1. In other embodiments, the memory 11 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the electronic device 1. Furthermore, the memory 11 can include both internal and external storage units of the electronic device 1. The memory 11 can be used not only to store application software and various types of data installed on the electronic device 1, such as the code of a page theme customization program, but also to temporarily store data that has been output or will be output.
[0077] The communication bus 12 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0078] The communication interface 13 is used for communication between the aforementioned electronic device 1 and other devices, including a network interface and an employee interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, Bluetooth interface, etc.), typically used to establish a communication connection between the electronic device 1 and other electronic devices 1. The employee interface may be a display, an input unit (such as a keyboard), or, optionally, a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual employee interface.
[0079] Figure 3 Only electronic device 1 with components is shown; those skilled in the art will understand that... Figure 3The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0080] For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0081] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in terms of the scope of the patent invention.
[0082] The page theme customization program stored in the memory 11 of the electronic device 1 is a combination of multiple computer programs. When run in the processor 10, it can achieve the following:
[0083] Based on the customization requirements of the page theme, construct the theme variables of the page theme, and generate the theme variable file of the page theme based on the theme variables;
[0084] The basic style of the theme variables in the theme variable file is configured using a preset pre-compiler, and a theme style file for the theme variable file is generated based on the basic style.
[0085] Receive the business source file, match the business theme style of the business source file with the theme style file, and generate the running style file of the business source file according to the business theme style;
[0086] The running style file is loaded into a preset running browser to obtain the page theme style of the business source file.
[0087] Specifically, the processor 10's implementation method of the above-mentioned computer program can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0088] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0089] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device 1, can perform the following:
[0090] Based on the customization requirements of the page theme, construct the theme variables of the page theme, and generate the theme variable file of the page theme based on the theme variables;
[0091] The basic style of the theme variables in the theme variable file is configured using a preset pre-compiler, and a theme style file for the theme variable file is generated based on the basic style.
[0092] Receive the business source file, match the business theme style of the business source file with the theme style file, and generate the running style file of the business source file according to the business theme style;
[0093] The running style file is loaded into a preset running browser to obtain the page theme style of the business source file.
[0094] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0095] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0096] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0097] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0098] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0099] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0100] The embodiments of this invention can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that utilize digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0101] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The term "second class" is used to indicate names and does not indicate any specific order.
[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for customizing page themes, characterized in that, The method includes: Based on the customization requirements of the page theme, construct the theme variables of the page theme, and generate the theme variable file of the page theme based on the theme variables; The topic sequence of the topic variable file is declared using a preset pre-compiler, and the structural style of the topic variables in the topic variable file is set. The structural style is converted into encoded variables and loaded into the topic sequence to obtain the basic style of the topic variables in the topic variable file. The topic styles in the topic variable file are summarized according to the basic style to obtain the topic style file of the topic variable file. Receive a business source file, obtain the business theme and theme style requirements of the business source file, read the basic theme style of the business theme from the theme style file, read the business theme style of the business theme from the basic theme style according to the theme style requirements, identify the position sequence of the business theme style in the business source file according to the business theme, and load the business theme style into the business source file according to the position sequence to obtain the running style file of the business source file; The running style file is loaded into a preset running browser to obtain the page theme style of the business source file.
2. The page theme customization method as described in claim 1, characterized in that, The step of constructing the theme variables of the page theme according to the customization requirements of the page theme includes: Based on the customization requirements, the theme type of the page theme is identified, and the page theme is coded according to the theme type to obtain the theme variable of the page theme.
3. The page theme customization method as described in claim 2, characterized in that, The step of generating the theme variable file for the page theme based on the theme variables includes: Obtain the compilation environment for the theme variables, define the variable form of each variable in the theme variables in the compilation environment, and generate the theme variable file for the page theme based on the variable form.
4. The page theme customization method as described in claim 1, characterized in that, Before loading the business theme style of the business source file from the theme style file, the following steps are also included: Obtain the browser version of the browser running the business source file, and determine whether the theme style file is compatible with the browser running the business source file based on the browser version; If the theme style file is incompatible with the running browser, then configure a compatibility plugin for the theme style file and the running browser.
5. A page theme customization device, characterized in that, The device includes: The theme variable file generation module is used to construct theme variables for the page theme according to the customization requirements of the page theme, and generate the theme variable file for the page theme based on the theme variables; The theme style file generation module is used to declare the theme sequence of the theme variable file using a preset pre-compiler, set the structural style of the theme variables in the theme variable file, convert the structural style into encoded variables and load them into the theme sequence to obtain the basic style of the theme variables in the theme variable file, and summarize the theme styles in the theme variable file according to the basic style to obtain the theme style file of the theme variable file. The style file generation module is used to receive the business source file, obtain the business theme and theme style requirements of the business source file, read the basic theme style of the business theme from the theme style file, read the business theme style of the business theme from the basic theme style according to the theme style requirements, identify the position sequence of the business theme style in the business source file according to the business theme, and load the business theme style into the business source file according to the position sequence to obtain the running style file of the business source file. The page theme style generation module is used to load the running style file into a preset running browser to obtain the page theme style of the business source file.
6. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the page theme customization method as described in any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the page theme customization method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Method, device and equipment for determining page theme, and storage medium
CN112099790A
Page element style customization method and device and storage medium
CN113010167A