{"id":16352157,"url":"https://github.com/bugthesystem/aspnet.mvc.theming","last_synced_at":"2025-03-23T01:30:53.094Z","repository":{"id":11958704,"uuid":"14530369","full_name":"bugthesystem/AspNet.Mvc.Theming","owner":"bugthesystem","description":"Enables implementing themes for ASP.NET MVC.","archived":false,"fork":false,"pushed_at":"2017-05-27T21:45:24.000Z","size":805,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-11T02:08:40.199Z","etag":null,"topics":["asp-net-mvc","c-sharp","theme"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bugthesystem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-19T16:28:52.000Z","updated_at":"2022-04-11T13:16:42.000Z","dependencies_parsed_at":"2022-09-12T01:01:17.660Z","dependency_job_id":null,"html_url":"https://github.com/bugthesystem/AspNet.Mvc.Theming","commit_stats":null,"previous_names":["bugthesystem/aspnet.mvc.theming","ziyasal/aspnet.mvc.theming"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugthesystem%2FAspNet.Mvc.Theming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugthesystem%2FAspNet.Mvc.Theming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugthesystem%2FAspNet.Mvc.Theming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugthesystem%2FAspNet.Mvc.Theming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugthesystem","download_url":"https://codeload.github.com/bugthesystem/AspNet.Mvc.Theming/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244257251,"owners_count":20424131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-mvc","c-sharp","theme"],"created_at":"2024-10-11T01:25:10.241Z","updated_at":"2025-03-23T01:30:52.517Z","avatar_url":"https://github.com/bugthesystem.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"AspNet.Mvc.Theming\n======================\n\nEnables implementing themes for ASP.NET MVC.\n\n[![Build status](https://ci.appveyor.com/api/projects/status/phs4m7tiwyy48jd9?svg=true)](https://ci.appveyor.com/project/ziyasal/aspnet-mvc-theming)\n\n* [Nuget Package - AspNet.Mvc.Theming](https://www.nuget.org/packages/AspNet.Mvc.Theming/)\n\nTo install AspNet.Mvc.Theming, \n```bash\nInstall-Package AspNet.Mvc.Theming\n```\n\u003e_**Area theme customization not implemented yet!**_\n\nHow to use;\n-----------------------------\n\n  Create [**Themes**](https://github.com/ziyasal/AspNet.Mvc.Theming/tree/master/src/AspNet.Mvc.Theming.Sample/Themes) (or what you want) folder and put your themes to folder and initialize [**ThemeManager**](https://github.com/ziyasal/AspNet.Mvc.Theming/blob/master/src/AspNet.Mvc.Theming/ThemeManager.cs) to use this folder to apply theme and set default theme;\n\n```csharp\n public class MvcApplication : System.Web.HttpApplication {\n        protected void Application_Start() {\n        \n           //Omitted for brevity..\n\n            ThemeManager.Instance.Configure(config =\u003e {\n                config.ThemeDirectory = \"~/Themes\";\n                config.DefaultTheme = \"Other\";\n            });\n        }\n    }\n```\n\nPut [**Theme**](https://github.com/ziyasal/AspNet.Mvc.Theming/blob/master/src/AspNet.Mvc.Theming/Attributes/ThemeAttribute.cs) attribute to your controller to use theme you want.\n```csharp\n [Theme(\"Default\")]\n    public class WorkController : Controller\n    {\n\n        [HttpGet]\n        public ActionResult Index()\n        {\n            return View(new WorkModel\n            {\n                Content = \"Hello World!\"\n            });\n        }\n\n    }\n```\n\n**Custom theme resolver**\n\nTo implement your custom theme resolver [see](https://github.com/ziyasal/AspNet.Mvc.Theming/blob/master/src/AspNet.Mvc.Theming.ThemeSelectorSample/Global.asax.cs#L7)\n\nSample: SessionThemeResolver\n```csharp\n   public class SessionThemeResolver : IThemeResolver\n   {\n        public string Resolve(ControllerContext controllerContext, string theme)\n        {\n            string result;\n\n            if (controllerContext.HttpContext.Session != null \u0026\u0026 controllerContext.HttpContext.Session[\"Theme\"] != null)\n            {\n                result = controllerContext.HttpContext.Session[\"Theme\"].ToString();\n            }\n            else\n            {\n                result = (!string.IsNullOrEmpty(theme) ? theme : \"Default\");\n            }\n\n            return result;\n        }\n    }\n```\n\ninit\n```csharp\n ThemeManager.Instance.Configure(config =\u003e\n {\n    config.ThemeDirectory = \"~/Themes\";\n    config.DefaultTheme = \"Default\";\n    config.ThemeResolver = new SessionThemeResolver();\n });\n```\n\nSave theme to sesion\n```csharp\n Session[\"Theme\"] = \"YourTheme\";\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugthesystem%2Faspnet.mvc.theming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugthesystem%2Faspnet.mvc.theming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugthesystem%2Faspnet.mvc.theming/lists"}