Redesigning the web look

This commit is contained in:
Alexander Yakovlev 2023-02-04 19:51:03 +07:00
parent 6d40d8f49c
commit c66b8914f1
11 changed files with 714 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.gif filter=lfs diff=lfs merge=lfs -text

8
.gitignore vendored
View File

@ -53,3 +53,11 @@ nosetests.xml
# Virtualenv
evenv
# Compiled CSS
web/static/website/css/
# JS modules
node_modules/
pnpm-lock.yaml
package.json.lock

View File

@ -3,6 +3,15 @@ This is the git repo for all the vantaMOO code.
Feel free to fork and make your own changes.
## Building the frontend
Install Node.js first.
* npm install
* npm run build
Restart Evennia after everytime you change and rebuild SCSS to pick up the changes. Do not edit CSS directly.
## Welcome to Evennia!
This is your game directory, set up to let you start with

9
package.json Normal file
View File

@ -0,0 +1,9 @@
{
"scripts": {
"build": "./node_modules/sass/sass.js scss/main.scss web/static/website/css/main.css"
},
"dependencies": {
"bootstrap": "^5.2.3",
"sass": "^1.58.0"
}
}

330
scss/_bootswatch.scss Normal file
View File

@ -0,0 +1,330 @@
// Vapor 5.2.2
// Bootswatch
// Variables
$web-font-path: "https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap" !default;
@if $web-font-path {
@import url($web-font-path);
}
$outrun: false !default;
:root {
color-scheme: dark;
}
// Mixins
@mixin text-shadow($color) {
text-shadow: 0 0 1px rgba($color, .6), 0 0 3px rgba($color, .5), 0 0 .5rem rgba($color, .3), 0 0 2rem rgba($color, .2);
}
@mixin text-shadow-sm($color) {
text-shadow: 0 0 1px rgba($color, .3), 0 0 2px rgba($color, .3), 0 0 5px rgba($color, .2);
}
@mixin box-shadow($color) {
box-shadow: 0 0 2px rgba($color, .9), 0 0 4px rgba($color, .4), 0 0 1rem rgba($color, .3), 0 0 4rem rgba($color, .1);
}
@mixin box-shadow-lg($color) {
box-shadow: 0 0 2rem rgba(tint-color($color, 10%), .4), 0 0 8rem rgba(tint-color($color, 10%), .3);
}
@mixin header-shadow($color) {
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
@include text-shadow($color);
}
}
// Body
body {
background-image: linear-gradient(shade-color($body-bg, 10%) 0%, $body-bg 7%, $body-bg 80%, shade-color(#173e98, 50%) 100%);
@include text-shadow-sm($body-color);
@if ($outrun) {
position: relative;
overflow-x: hidden;
&::after {
position: absolute;
bottom: 0;
left: -50vw;
z-index: -1;
display: block;
width: 200vw;
height: 100vh;
content: "";
background-image: repeating-linear-gradient(rgba($blue, .6) 0 1px, transparent 1px 100%), repeating-linear-gradient(90deg, rgba($blue, .6) 0 1px, transparent 1px 100%);
background-size: 200px 200px;
transform: perspective(50vh) rotateX(50deg) translateY(-11.3vh) translateZ(10px);
transform-origin: center center;
}
}
}
// Typography
@include header-shadow($cyan);
.text {
@each $color, $value in $theme-colors {
&-#{$color} {
@include text-shadow-sm($value);
}
}
&-white {
@include text-shadow-sm($white);
@include header-shadow($white);
}
&-muted {
@include text-shadow-sm(shade-color($text-muted, 20%));
}
}
a {
@include text-shadow-sm($link-color);
}
.blockquote {
&-footer {
@include text-shadow-sm(shade-color($blockquote-footer-color, 20%));
}
}
hr {
border-top: 1px solid $primary;
@include box-shadow($primary);
opacity: 1;
}
// Tables
table,
.table {
@include text-shadow-sm($white);
}
// Buttons
.btn {
@each $color, $value in $theme-colors {
@if (($color != dark) or ($color != link)) {
&-#{$color},
&-outline-#{$color} {
@include box-shadow($value);
}
}
&-#{$color} {
@include text-shadow-sm($white);
}
&-outline-#{$color} {
color: $white;
border-width: 2px;
}
}
&-dark {
@include box-shadow($primary);
}
&-link {
box-shadow: none;
@include text-shadow($body-color);
}
&-outline-dark {
color: $white;
}
}
// Navbars
.navbar {
@each $color, $value in $theme-colors {
&.bg-#{$color} {
@include box-shadow($value);
}
}
}
.navbar-dark {
&,
a {
@include text-shadow-sm($navbar-dark-color);
}
.navbar-brand {
@include text-shadow($navbar-dark-color);
}
}
.navbar-light {
&,
a {
@include text-shadow-sm($navbar-light-color);
}
.navbar-brand {
@include text-shadow($navbar-light-color);
}
}
// Navs
.nav-link {
&.disabled {
@include text-shadow-sm($nav-link-disabled-color);
}
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
@include text-shadow-sm($component-active-bg);
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
@include box-shadow($component-active-bg);
}
.breadcrumb {
&-item.active {
@include text-shadow-sm($breadcrumb-active-color);
}
&-item + .breadcrumb-item::before {
@include text-shadow-sm($breadcrumb-divider-color);
}
}
.page-link {
border-radius: $border-radius;
}
.page-item.active {
.page-link {
@include box-shadow($component-active-bg);
}
}
// Forms
legend {
@include text-shadow($body-color);
}
.valid-feedback {
@include text-shadow-sm($success);
}
.invalid-feedback {
@include text-shadow-sm($danger);
}
// Indicators
.alert {
@each $color, $value in $theme-colors {
&-#{$color} {
color: $white;
background-color: $value;
@include text-shadow-sm($white);
@include box-shadow-lg($value);
}
}
.alert-link,
a {
color: $white;
}
@include header-shadow($white);
}
.progress {
overflow: visible;
&-bar {
@include box-shadow($primary);
@each $color, $value in $theme-colors {
&.bg-#{$color} {
@include box-shadow($value);
}
}
}
}
.tooltip {
&-inner,
.arrow {
@include box-shadow-lg($primary);
}
}
.modal,
.popover,
.toast {
@include text-shadow-sm($white);
@include header-shadow($white);
}
.popover,
.toast {
@include box-shadow-lg($primary);
}
.modal {
&-content {
@include box-shadow-lg($primary);
}
}
// Containers
.list-group {
&-item.active {
@include header-shadow($white);
}
}
.card {
background-color: transparent;
@include text-shadow-sm($white);
@each $color, $value in $theme-colors {
@if ($color != dark) {
&.border-#{$color} {
@include box-shadow($value);
}
}
}
&.border-dark {
@include box-shadow($primary);
}
@include header-shadow($white);
}

7
scss/_customvars.scss Normal file
View File

@ -0,0 +1,7 @@
.navbar {
a.nav-link,
.navbar-brand {
color: yellow;
text-shadow: #FC0 1px 0 10px;
}
}

162
scss/_variables.scss Normal file
View File

@ -0,0 +1,162 @@
// Vapor 5.2.2
// Bootswatch
$theme: "vapor" !default;
//
// Color system
//
$white: #fff !default;
$gray-100: #f8f9fa !default;
$gray-200: #e9ecef !default;
$gray-300: #dee2e6 !default;
$gray-400: #ced4da !default;
$gray-500: #adb5bd !default;
$gray-600: #6c757d !default;
$gray-700: #495057 !default;
$gray-800: #343a40 !default;
$gray-900: #170229 !default;
$black: #000 !default;
$blue: #1ba2f6 !default;
$indigo: #6610f2 !default;
$purple: #6f42c1 !default;
$pink: #ea39b8 !default;
$red: #e44c55 !default;
$orange: #f1b633 !default;
$yellow: #ffc107 !default;
$green: #3cf281 !default;
$teal: #3f81a2 !default;
$cyan: #32fbe2 !default;
$primary: $purple !default;
$secondary: $pink !default;
$success: $green !default;
$info: $blue !default;
$warning: $yellow !default;
$danger: $red !default;
$light: #44d9e8 !default;
$dark: $gray-900 !default;
$min-contrast-ratio: 1.2 !default;
// Options
// $enable-rounded: false !default;
// Body
$body-bg: #1a0933 !default;
$body-color: $cyan !default;
// Links
$link-color: $body-color !default;
// Components
$border-width: 0 !default;
$border-radius: .15rem !default;
$border-radius-sm: .05rem !default;
$component-active-bg: $pink !default;
// Fonts
// stylelint-disable-next-line value-keyword-case
$font-family-sans-serif: Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !default;
$text-muted: rgba($body-color, .3) !default;
$blockquote-footer-color: $text-muted !default;
// Tables
$table-color: $white !default;
$table-bg-scale: 0% !default;
// Forms
$input-bg: lighten($body-bg, 10%) !default;
$input-disabled-bg: lighten($body-bg, 5%) !default;
$input-color: $white !default;
$input-placeholder-color: rgba($white, .4) !default;
$input-group-addon-bg: $input-disabled-bg !default;
$form-range-track-bg: $input-bg !default;
$form-range-thumb-disabled-bg: $purple !default;
// Navs
$nav-link-disabled-color: $text-muted !default;
$nav-tabs-link-active-color: $component-active-bg !default;
// Pagination
$pagination-bg: transparent !default;
$pagination-focus-bg: transparent !default;
$pagination-hover-bg: transparent !default;
$pagination-disabled-color: $text-muted !default;
$pagination-disabled-bg: transparent !default;
// Cards
$card-border-width: 2px !default;
$card-cap-color: $white !default;
$card-color: $white !default;
// Tooltips
$tooltip-bg: $dark !default;
$tooltip-opacity: 1 !default;
// Popovers
$popover-bg: $primary !default;
$popover-header-color: $white !default;
$popover-body-color: $white !default;
// Toasts
$toast-color: $white !default;
$toast-background-color: $primary !default;
$toast-header-color: $toast-color !default;
$toast-header-background-color: $toast-background-color !default;
// Modals
$modal-content-color: $white !default;
$modal-content-bg: $primary !default;
// Progress bars
$progress-bg: $input-disabled-bg !default;
// List group
$list-group-color: $white !default;
$list-group-bg: $input-disabled-bg !default;
$list-group-hover-bg: $pink !default;
$list-group-disabled-color: $text-muted !default;
$list-group-action-color: $body-color !default;
$list-group-action-hover-color: $white !default;
$list-group-action-active-bg: $list-group-hover-bg !default;
// Breadcrumbs
$breadcrumb-divider-color: $text-muted !default;
$breadcrumb-active-color: $component-active-bg !default;

28
scss/main.scss Normal file
View File

@ -0,0 +1,28 @@
// Bootstrap functions and mixins
@import '../node_modules/bootstrap/scss/_mixins.scss';
@import '../node_modules/bootstrap/scss/_functions.scss';
// Theme variables to redefine Bootstrap vars
@import '_variables';
@import '_customvars';
// Bootstrap base variables
@import '../node_modules/bootstrap/scss/_variables.scss';
// Base Bootstrap styles
@import '../node_modules/bootstrap/scss/bootstrap.scss';
// Bootswatch rules to override defaults
@import '_bootswatch';
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
white-space: nowrap;
border: 0;
clip: rect(0,0,0,0);
}
.navbar {
background-image: url('../images/stars.gif');
background-color: transparent;
}

BIN
web/static/website/images/stars.gif (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,90 @@
{% comment %}
Allow to customize the menu that appears at the top of every Evennia
webpage. Copy this file to your game dir's web/template_overrides/website
folder and edit it to add/remove links to the menu.
{% endcomment %}
{% load static %}
<nav class="navbar navbar-expand-md bg-body-tertiary">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="/">
<div class="media">
<img class="d-flex navbar-brand-logo mx-3" src="{% static "website/images/evennia_logo.png" %}" alt="{{game_name}} logo" />
<div class="media-body">
{{ game_name }}<br />
<small>{{game_slogan}}</small>
</div>
</div>
</a>
<li class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mg-lg-0">
{% block navbar_left %}
<li class="nav-item">
<a class="nav-link" href="{% url 'index' %}">Home</a>
</li>
<!-- game views -->
<li class="nav-item"><a class="nav-link" href="{% url 'characters' %}">Characters</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'channels' %}">Channels</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'help' %}">Help</a></li>
<!-- end game views -->
{% if webclient_enabled %}
<li class="nav-item"><a class="nav-link" href="{% url 'webclient:index' %}">Play Online</a></li>
{% endif %}
{% if user.is_staff %}
<li class="nav-item"><a class="nav-link" href="{% url 'admin:index' %}">Admin</a></li>
{% if rest_api_enabled %}
<li class="nav-item"><a class="nav-link" href="/api">API</a></li>
{% endif %}
{% endif %}
{% endblock %}
</ul>
<ul class="navbar-nav me-auto mb-2 mb-lg-0 justify-content-end">
{% block navbar_right %}
{% endblock %}
{% block navbar_user %}
{% if account %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" id="user_options" aria-expanded="false">
{% if puppet %}
Welcome, {{ puppet }}! <span class="text-muted">({{ account.username }})</span> <span class="caret"></span>
{% else %}
Logged in as {{ account.username }} <span class="caret"></span>
{% endif %}
</a>
<ul class="dropdown-menu" aria-labelledby="user_options">
<li><a class="dropdown-item" href="{% url 'character-create' %}">Create Character</a></li>
<li><a class="dropdown-item" href="{% url 'character-manage' %}">Manage Characters</a></li>
<li><hr class="dropdown-divider"></li>
{% for character in account.characters|slice:"10" %}
<li><a class="dropdown-item" href="{{ character.web_get_puppet_url }}?next={{ request.path }}">{{ character }}</a></li>
{% empty %}
<li><a class="dropdown-item" href="#">No characters found!</a></li>
{% endfor %}
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{% url 'password_change' %}">Change Password</a></li>
<li><a class="dropdown-item" href="{% url 'logout' %}">Log Out</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'logout' %}">Log Out</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'login' %}?next={{ request.path }}">Log In</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'register' %}">Register</a>
</li>
{% endif %}
{% endblock %}
</ul>
</div>
</div>
</nav>

View File

@ -0,0 +1,67 @@
{% load static sekizai_tags %}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="author" content="Evennia Contributors" />
<meta name="generator" content="Evennia" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" type="image/x-icon" href="{% static "website/images/evennia_logo.png" %}" />
{% comment %}
Base Evennia, then our CSS, then whatever's in custom CSS.
You can edit both SCSS and CSS.
{% endcomment %}
<link rel="stylesheet" type="text/css" href="{% static "website/css/website.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "website/css/main.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "website/css/custom.css" %}">
{% block header_ext %}
{% endblock %}
<title>{{game_name}} - {% if flatpage %}{{flatpage.title}}{% else %}{% block titleblock %}{{page_title}}{% endblock %}{% endif %}</title>
</head>
<body>
{% block body %}
<div id="top"><a href="#main-content" class="sr-only sr-only-focusable">Skip to main content.</a></div>
{% include "website/_menu.html" %}
<div class="container main-content mt-4" id="main-copy">
<div class="row">
{% if sidebar %}
<div class="col-4">
{% block sidebar %}
{% endblock %}
</div>
{% endif %}
<div class="{% if sidebar %}col-8{% else %}col{% endif %}">
{% include 'website/messages.html' %}
{% block content %}
{% endblock %}
{% include 'website/pagination.html' %}
</div>
</div>
</div>
<footer class="footer">
{% block footer %}
<div class="container">
<div class="row justify-content-center">
<span class="text-white">Powered by <a class="text-white font-weight-bold" href="https://evennia.com">Evennia.</a></span>
</div>
</div>
{% endblock %}
</footer>
{% endblock %}
<!-- jQuery first, then Tether, then Bootstrap JS. -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js" integrity="sha384-mQ93GR66B00ZXjt0YO5KlohRA5SY2XofN4zfuZxLkoj1gXtW8ANNCe9d5Y3eG5eD" crossorigin="anonymous"></script>
</body>
</html>