diff --git a/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj b/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj index 73d5a86..b098924 100644 --- a/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj +++ b/DiscordChatExporter.Core/DiscordChatExporter.Core.csproj @@ -12,12 +12,10 @@ - - - + \ No newline at end of file diff --git a/DiscordChatExporter.Core/Exporting/Writers/Html/Core.css b/DiscordChatExporter.Core/Exporting/Writers/Html/Core.css deleted file mode 100644 index e7724a2..0000000 --- a/DiscordChatExporter.Core/Exporting/Writers/Html/Core.css +++ /dev/null @@ -1,537 +0,0 @@ -/* General */ - -@font-face { - font-family: Whitney; - src: url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/whitney-300.woff); - font-weight: 300; -} - -@font-face { - font-family: Whitney; - src: url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/whitney-400.woff); - font-weight: 400; -} - -@font-face { - font-family: Whitney; - src: url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/whitney-500.woff); - font-weight: 500; -} - -@font-face { - font-family: Whitney; - src: url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/whitney-600.woff); - font-weight: 600; -} - -@font-face { - font-family: Whitney; - src: url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/whitney-700.woff); - font-weight: 700; -} - -body { - font-family: "Whitney", "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 17px; -} - -a { - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -img { - object-fit: contain; -} - -.markdown { - max-width: 100%; - line-height: 1.3; - overflow-wrap: break-word; -} - -.preserve-whitespace { - white-space: pre-wrap; -} - -.spoiler { - /* width: fit-content; */ - display: inline-block; - /* This is more consistent across browsers, the old attribute worked well under Chrome but not FireFox. */ -} - -.spoiler--hidden { - cursor: pointer; -} - -.spoiler-text { - border-radius: 3px; -} - -.spoiler--hidden .spoiler-text { - color: rgba(0, 0, 0, 0); -} - -.spoiler--hidden .spoiler-text::selection { - color: rgba(0, 0, 0, 0); -} - -.spoiler-image { - position: relative; - overflow: hidden; - border-radius: 3px; -} - -.spoiler--hidden .spoiler-image { - box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.1); -} - -.spoiler--hidden .spoiler-image * { - filter: blur(44px); -} - -.spoiler--hidden .spoiler-image:after { - content: "SPOILER"; - color: #dcddde; - background-color: rgba(0, 0, 0, 0.6); - position: absolute; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); - font-weight: 600; - padding: 100%; - border-radius: 20px; - letter-spacing: 0.05em; - font-size: 0.9em; -} - -.spoiler--hidden:hover .spoiler-image:after { - color: #fff; - background-color: rgba(0, 0, 0, 0.9); -} - -.quote { - margin: 0.1em 0; - padding-left: 0.6em; - border-left: 4px solid; - border-radius: 3px; -} - -.pre { - font-family: "Consolas", "Courier New", Courier, monospace; -} - -.pre--multiline { - margin-top: 0.25em; - padding: 0.5em; - border: 2px solid; - border-radius: 5px; -} - -.pre--inline { - padding: 2px; - border-radius: 3px; - font-size: 0.85em; -} - -.mention { - border-radius: 3px; - padding: 0 2px; - color: #7289da; - background: rgba(114, 137, 218, .1); - font-weight: 500; -} - -.emoji { - width: 1.325em; - height: 1.325em; - margin: 0 0.06em; - vertical-align: -0.4em; -} - -.emoji--small { - width: 1em; - height: 1em; -} - -.emoji--large { - width: 2.8em; - height: 2.8em; -} - -/* Preamble */ - -.preamble { - display: grid; - margin: 0 0.3em 0.6em 0.3em; - max-width: 100%; - grid-template-columns: auto 1fr; -} - -.preamble__guild-icon-container { - grid-column: 1; -} - -.preamble__guild-icon { - max-width: 88px; - max-height: 88px; -} - -.preamble__entries-container { - grid-column: 2; - margin-left: 0.6em; -} - -.preamble__entry { - font-size: 1.4em; -} - -.preamble__entry--small { - font-size: 1em; -} - -/* Chatlog */ - -.chatlog { - max-width: 100%; -} - -.chatlog__message-group { - display: grid; - margin: 0 0.6em; - padding: 0.9em 0; - border-top: 1px solid; - grid-template-columns: auto 1fr; -} - -.chatlog__reference-symbol { - grid-column: 1; - border-style: solid; - border-width: 2px 0 0 2px; - border-radius: 8px 0 0 0; - margin-left: 16px; - margin-top: 8px; -} - -.chatlog__reference { - display: flex; - grid-column: 2; - margin-left: 1.2em; - margin-bottom: 0.25em; - font-size: 0.875em; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - align-items: center; -} - -.chatlog__reference-avatar { - border-radius: 50%; - height: 16px; - width: 16px; - margin-right: 0.25em; -} - -.chatlog__reference-name { - margin-right: 0.25em; - font-weight: 600; -} - -.chatlog__reference-link { - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; - cursor: pointer; -} - -.chatlog__reference-content > * { - display: inline; - pointer-events: none; -} - -.chatlog__reference-content > a:hover { - text-decoration: none; -} - -.chatlog__reference-edited-timestamp { - margin-left: 0.25em; - font-size: 0.8em; -} - -.chatlog__author-avatar-container { - grid-column: 1; - width: 40px; - height: 40px; -} - -.chatlog__author-avatar { - border-radius: 50%; - height: 40px; - width: 40px; -} - -.chatlog__messages { - grid-column: 2; - margin-left: 1.2em; - min-width: 50%; -} - -.chatlog__author-name { - font-weight: 500; -} - -.chatlog__timestamp { - margin-left: 0.3em; - font-size: 0.75em; -} - -.chatlog__message { - padding: 0.1em 0.3em; - margin: 0 -0.3em; - background-color: transparent; - transition: background-color 1s ease; -} - -.chatlog__content { - font-size: 0.95em; - word-wrap: break-word; -} - -.chatlog__edited-timestamp { - margin-left: 0.15em; - font-size: 0.8em; -} - -.chatlog__attachment { - margin-top: 0.3em; -} - -.chatlog__attachment-thumbnail { - vertical-align: top; - max-width: 45vw; - max-height: 500px; - border-radius: 3px; -} - -.chatlog__attachment-container { - height: 40px; - width: 100%; - max-width: 520px; - padding: 10px; - border: 1px solid; - border-radius: 3px; - overflow: hidden; -} - -.chatlog__attachment-icon { - float: left; - height: 100%; - margin-right: 10px; -} - -.chatlog__attachment-icon > .a { - fill: #f4f5fb; - d: path("M50,935a25,25,0,0,1-25-25V50A25,25,0,0,1,50,25H519.6L695,201.32V910a25,25,0,0,1-25,25Z"); -} - -.chatlog__attachment-icon > .b { - fill: #7789c4; - d: path("M509.21,50,670,211.63V910H50V50H509.21M530,0H50A50,50,0,0,0,0,50V910a50,50,0,0,0,50,50H670a50,50,0,0,0,50-50h0V191Z"); -} - -.chatlog__attachment-icon > .c { - fill: #f4f5fb; - d: path("M530,215a25,25,0,0,1-25-25V50a25,25,0,0,1,16.23-23.41L693.41,198.77A25,25,0,0,1,670,215Z"); -} - -.chatlog__attachment-icon > .d { - fill: #7789c4; - d: path("M530,70.71,649.29,190H530V70.71M530,0a50,50,0,0,0-50,50V190a50,50,0,0,0,50,50H670a50,50,0,0,0,50-50Z"); -} - -.chatlog__attachment-filesize { - color: #72767d; - font-size: 12px; -} - -.chatlog__attachment-filename { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.chatlog__embed { - display: flex; - margin-top: 0.3em; - max-width: 520px; -} - -.chatlog__embed-color-pill { - flex-shrink: 0; - width: 0.25em; - border-top-left-radius: 3px; - border-bottom-left-radius: 3px; -} - -.chatlog__embed-content-container { - display: flex; - flex-direction: column; - padding: 0.5em 0.6em; - border: 1px solid; - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; -} - -.chatlog__embed-content { - display: flex; - width: 100%; -} - -.chatlog__embed-text { - flex: 1; -} - -.chatlog__embed-author { - display: flex; - margin-bottom: 0.3em; - align-items: center; -} - -.chatlog__embed-author-icon { - margin-right: 0.5em; - width: 20px; - height: 20px; - border-radius: 50%; -} - -.chatlog__embed-author-name { - font-size: 0.875em; - font-weight: 600; -} - -.chatlog__embed-title { - margin-bottom: 0.2em; - font-size: 0.875em; - font-weight: 600; -} - -.chatlog__embed-description { - font-weight: 500; - font-size: 0.85em; -} - -.chatlog__embed-fields { - display: flex; - flex-wrap: wrap; -} - -.chatlog__embed-field { - flex: 0; - min-width: 100%; - max-width: 506px; - padding-top: 0.6em; - font-size: 0.875em; -} - -.chatlog__embed-field--inline { - flex: 1; - flex-basis: auto; - min-width: 150px; -} - -.chatlog__embed-field-name { - margin-bottom: 0.2em; - font-weight: 600; -} - -.chatlog__embed-field-value { - font-weight: 500; -} - -.chatlog__embed-thumbnail { - flex: 0; - margin-left: 1.2em; - max-width: 80px; - max-height: 80px; - border-radius: 3px; -} - -.chatlog__embed-image-container { - margin-top: 0.6em; -} - -.chatlog__embed-image { - max-width: 500px; - max-height: 400px; - border-radius: 3px; -} - -.chatlog__embed-footer { - margin-top: 0.6em; -} - -.chatlog__embed-footer-icon { - margin-right: 0.2em; - width: 20px; - height: 20px; - border-radius: 50%; - vertical-align: middle; -} - -.chatlog__embed-footer-text { - vertical-align: middle; - font-size: 0.75em; - font-weight: 500; -} - -.chatlog__embed-youtube-container { - margin-top: 0.6em; -} - -.chatlog__embed-youtube { - border: 0; - border-radius: 3px; -} - -.chatlog__reactions { - display: flex; -} - -.chatlog__reaction { - display: flex; - align-items: center; - margin: 0.35em 0.1em 0.1em 0.1em; - padding: 0.2em 0.35em; - border-radius: 3px; -} - -.chatlog__reaction-count { - min-width: 9px; - margin-left: 0.35em; - font-size: 0.875em; -} - -.chatlog__bot-tag { - position: relative; - top: -.2em; - margin-left: 0.3em; - padding: 0.05em 0.3em; - border-radius: 3px; - vertical-align: middle; - line-height: 1.3; - background: #5865F2; - color: #ffffff; - font-size: 0.625em; - font-weight: 500; -} - -/* Postamble */ - -.postamble { - margin: 1.4em 0.3em 0.6em 0.3em; - padding: 1em; - border-top: 1px solid; -} \ No newline at end of file diff --git a/DiscordChatExporter.Core/Exporting/Writers/Html/Dark.css b/DiscordChatExporter.Core/Exporting/Writers/Html/Dark.css deleted file mode 100644 index 2242684..0000000 --- a/DiscordChatExporter.Core/Exporting/Writers/Html/Dark.css +++ /dev/null @@ -1,147 +0,0 @@ -/* General */ - -body { - background-color: #36393e; - color: #dcddde; -} - -a { - color: #00aff4; -} - -.spoiler-text { - background-color: rgba(255, 255, 255, 0.1); -} - -.spoiler--hidden .spoiler-text { - background-color: #202225; -} - -.spoiler--hidden:hover .spoiler-text { - background-color: rgba(32, 34, 37, 0.8); -} - -.quote { - border-color: #4f545c; -} - -.pre { - background-color: #2f3136 !important; -} - -.pre--multiline { - border-color: #282b30 !important; - color: #b9bbbe !important; -} - -/* Preamble */ - -.preamble__entry { - color: #ffffff; -} - -/* Chatlog */ - -.chatlog__message-group { - border-color: rgba(255, 255, 255, 0.1); -} - -.chatlog__reference-symbol { - border-color: #4f545c; -} - -.chatlog__reference { - color: #b5b6b8; -} - -.chatlog__reference-link { - color: #b5b6b8; -} - -.chatlog__reference-link:hover { - color: #ffffff; -} - -.chatlog__reference-edited-timestamp { - color: rgba(255, 255, 255, 0.2); -} - -.chatlog__author-name { - color: #ffffff; -} - -.chatlog__timestamp { - color: rgba(255, 255, 255, 0.2); -} - -.chatlog__message--highlighted { - background-color: rgba(114, 137, 218, 0.2) !important; -} - -.chatlog__message--pinned { - background-color: rgba(249, 168, 37, 0.05); -} - -.chatlog__attachment-container { - background-color: #2f3136; - border-color: #292b2f; -} - -.chatlog__edited-timestamp { - color: rgba(255, 255, 255, 0.2); -} - -.chatlog__embed-color-pill--default { - background-color: #202225; -} - -.chatlog__embed-content-container { - background-color: rgba(46, 48, 54, 0.3); - border-color: rgba(46, 48, 54, 0.6); -} - -.chatlog__embed-author-name { - color: #ffffff; -} - -.chatlog__embed-author-name-link { - color: #ffffff; -} - -.chatlog__embed-title { - color: #ffffff; -} - -.chatlog__embed-description { - color: #dcddde; -} - -.chatlog__embed-field-name { - color: #ffffff; -} - -.chatlog__embed-field-value { - color: #dcddde; -} - -.chatlog__embed-footer { - color: #dcddde; -} - -.chatlog__reaction { - background-color: rgba(255, 255, 255, 0.05); -} - -.chatlog__reaction-count { - color: rgba(255, 255, 255, 0.3); -} - -/* Postamble */ - -.postamble { - border-color: rgba(255, 255, 255, 0.1); -} - -.postamble__entry { - color: #ffffff; -} \ No newline at end of file diff --git a/DiscordChatExporter.Core/Exporting/Writers/Html/Light.css b/DiscordChatExporter.Core/Exporting/Writers/Html/Light.css deleted file mode 100644 index 7072169..0000000 --- a/DiscordChatExporter.Core/Exporting/Writers/Html/Light.css +++ /dev/null @@ -1,149 +0,0 @@ -/* General */ - -body { - background-color: #ffffff; - color: #23262a; - font-weight: 500; -} - -a { - color: #0068e0; -} - -.spoiler-text { - background-color: rgba(0, 0, 0, 0.1); -} - -.spoiler--hidden .spoiler-text { - background-color: #b9bbbe; -} - -.spoiler--hidden:hover .spoiler-text { - background-color: rgba(185, 187, 190, 0.8); -} - -.quote { - border-color: #c7ccd1; -} - -.pre { - background-color: #f9f9f9 !important; -} - -.pre--multiline { - border-color: #f3f3f3 !important; - color: #657b83 !important; -} - -/* Preamble */ - -.preamble__entry { - color: #2f3136; -} - -/* Chatlog */ - -.chatlog__message-group { - border-color: #eceeef; -} - -.chatlog__reference-symbol { - border-color: #c7ccd1; -} - -.chatlog__reference { - color: #5f5f60; -} - -.chatlog__reference-link { - color: #5f5f60; -} - -.chatlog__reference-link:hover { - color: #2f3136; -} - -.chatlog__reference-edited-timestamp { - color: #747f8d; -} - -.chatlog__author-name { - font-weight: 600; - color: #2f3136; -} - -.chatlog__timestamp { - color: #747f8d; -} - -.chatlog__message--highlighted { - background-color: rgba(114, 137, 218, 0.2) !important; -} - -.chatlog__message--pinned { - background-color: rgba(249, 168, 37, 0.05); -} - -.chatlog__attachment-container { - background-color: #f2f3f5; - border-color: #ebedef; -} - -.chatlog__edited-timestamp { - color: #747f8d; -} - -.chatlog__embed-color-pill--default { - background-color: rgba(227, 229, 232, 1); -} - -.chatlog__embed-content-container { - background-color: rgba(249, 249, 249, 0.3); - border-color: rgba(204, 204, 204, 0.3); -} - -.chatlog__embed-author-name { - color: #4f545c; -} - -.chatlog__embed-author-name-link { - color: #4f545c; -} - -.chatlog__embed-title { - color: #4f545c; -} - -.chatlog__embed-description { - color: #2e3338; -} - -.chatlog__embed-field-name { - color: #36393e; -} - -.chatlog__embed-field-value { - color: #2e3338; -} - -.chatlog__embed-footer { - color: #2e3338; -} - -.chatlog__reaction { - background-color: rgba(79, 84, 92, 0.06); -} - -.chatlog__reaction-count { - color: #747f8d; -} - -/* Postamble */ - -.postamble { - border-color: #eceeef; -} - -.postamble__entry { - color: #2f3136; -} \ No newline at end of file diff --git a/DiscordChatExporter.Core/Exporting/Writers/Html/PreambleTemplate.cshtml b/DiscordChatExporter.Core/Exporting/Writers/Html/PreambleTemplate.cshtml index d385d7b..e36f52b 100644 --- a/DiscordChatExporter.Core/Exporting/Writers/Html/PreambleTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/Writers/Html/PreambleTemplate.cshtml @@ -1,6 +1,5 @@ @using System @using System.Threading.Tasks -@using Tyrrrz.Extensions @namespace DiscordChatExporter.Core.Exporting.Writers.Html @inherits MiniRazor.TemplateBase @@ -8,8 +7,6 @@ string FormatDate(DateTimeOffset date) => Model.ExportContext.FormatDate(date); ValueTask ResolveUrlAsync(string url) => Model.ExportContext.ResolveMediaUrlAsync(url); - - string GetStyleSheet(string name) => Model.GetType().Assembly.GetManifestResourceString($"DiscordChatExporter.Core.Exporting.Writers.Html.{name}.css"); } @@ -20,12 +17,7 @@ - - + @{ await StylesheetTemplate.RenderAsync(Output, Model); } @@ -98,4 +90,4 @@ -
+
\ No newline at end of file diff --git a/DiscordChatExporter.Core/Exporting/Writers/Html/StylesheetTemplate.cshtml b/DiscordChatExporter.Core/Exporting/Writers/Html/StylesheetTemplate.cshtml new file mode 100644 index 0000000..18a974a --- /dev/null +++ b/DiscordChatExporter.Core/Exporting/Writers/Html/StylesheetTemplate.cshtml @@ -0,0 +1,854 @@ +@using System +@namespace DiscordChatExporter.Core.Exporting.Writers.Html +@inherits MiniRazor.TemplateBase + +@{ + var isDarkTheme = string.Equals(Model.ThemeName, "Dark", StringComparison.OrdinalIgnoreCase); +} + + + +@if (isDarkTheme) +{ + +} +else +{ + +} \ No newline at end of file