Skip to content

Customized default theme interferes with other themes #2

Description

@boxfries

When customizing the default theme, adding new CSS properties causes these to "leak" through to other themes when their properties aren't set. This is because the default theme is persistent, and always loads regardless of which theme is selected.

2021-07-31_211152

Header styling from default theme leaking through to "Deep" theme.

I found a solution by adding "disabled" to the default CSS theme when changing themes, and removing it when switching back to each html file under themes. But I don't know if it's good code. (I only know some HTML/CSS)

	<link rel="stylesheet" href="<% echo(skindir) %>css/mono_main.css?v=1.1" id="css0">
	<link rel="stylesheet" href="<% echo(skindir) %>css/mono_dev.css" id="css1" disabled>
	<link rel="stylesheet" href="<% echo(skindir) %>css/mono_dark.css" id="css2" disabled>
	<link rel="stylesheet" href="<% echo(skindir) %>css/mono_deep.css" id="css3" disabled>
	<link rel="stylesheet" href="<% echo(skindir) %>css/mono_mayo.css" id="css4" disabled>

<script>
	var colorIdx = GetCookie("colorIdx");
		switch (Number(colorIdx)) {
		case 0:
			document.getElementById("css0").removeAttribute("disabled");
			break;
		case 1:
			document.getElementById("css1").removeAttribute("disabled");
			document.getElementById("css0").setAttribute("disabled", "");
			break;
		case 2:
			document.getElementById("css2").removeAttribute("disabled");
			document.getElementById("css0").setAttribute("disabled", "");
			break;
		case 3:
			document.getElementById("css3").removeAttribute("disabled");
			document.getElementById("css0").setAttribute("disabled", "");
			break;
		case 4:
			document.getElementById("css4").removeAttribute("disabled");
			document.getElementById("css0").setAttribute("disabled", "");
		break;
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions