diff --git a/manage b/manage index daa7171d..07761e76 100755 --- a/manage +++ b/manage @@ -692,11 +692,45 @@ themes.oscar() { } themes.simple() { - build_msg GRUNT "theme: simple" - npm --prefix searx/static/themes/simple run build + local src="searx/static/themes/simple/src" + local static="searx/static/themes/simple" + ( set -e + convert_if_newer "$src/svg/searxng-wordmark.svg" "$static/img/favicon.png" \ + -transparent white -resize 64x64 + build_msg GRUNT "theme: simple" + npm --prefix searx/static/themes/simple run build + ) dump_return $? } +convert_if_newer() { + + # usage: convert_if_newer [, ...] + # + # convert_if_newer "path/to/origin.svg" "path/to/converted.png" -resize 100x100 + # + # Run's ImageMagik' convert comand to generate from , if + # is newer than . The command line is to convert is:: + # + # convert [, ...] + + local src_file="$1" && shift + local dst_file="$1" && shift + + if [[ "${src_file}" -nt "${dst_file}" ]]; then + if ! required_commands convert; then + info_msg "to install build tools use::" + info_msg " sudo -H ./utils/searx.sh install buildhost" + die 1 "install needed build tools first" + fi + build_msg CONVERT "${src_file}" "$@" "${dst_file}" + convert "${src_file}" "$@" "${dst_file}" + else + build_msg CONVERT "${dst_file} (up-to-date)" + fi +} + + PYLINT_FILES=() while IFS= read -r line; do PYLINT_FILES+=("$line") diff --git a/searx/static/themes/simple/css/searxng-rtl.css b/searx/static/themes/simple/css/searxng-rtl.css index 71b0c2ff..77483b01 100644 --- a/searx/static/themes/simple/css/searxng-rtl.css +++ b/searx/static/themes/simple/css/searxng-rtl.css @@ -2369,9 +2369,15 @@ article.result-images .detail { } #search_logo { grid-area: logo; + display: flex; + align-items: center; + justify-content: center; } -.search_logo_img { - width: 40px; +#search_logo svg { + flex: 1; + width: 30px; + height: 30px; + margin: 0.5rem 0 auto 0; } .search_categories { grid-area: categories; diff --git a/searx/static/themes/simple/css/searxng-rtl.min.css b/searx/static/themes/simple/css/searxng-rtl.min.css index f677c618..e93db093 100644 Binary files a/searx/static/themes/simple/css/searxng-rtl.min.css and b/searx/static/themes/simple/css/searxng-rtl.min.css differ diff --git a/searx/static/themes/simple/css/searxng-rtl.min.css.map b/searx/static/themes/simple/css/searxng-rtl.min.css.map index a44c38ba..fe208f04 100644 Binary files a/searx/static/themes/simple/css/searxng-rtl.min.css.map and b/searx/static/themes/simple/css/searxng-rtl.min.css.map differ diff --git a/searx/static/themes/simple/css/searxng.css b/searx/static/themes/simple/css/searxng.css index 5f5f3e53..6313dc79 100644 --- a/searx/static/themes/simple/css/searxng.css +++ b/searx/static/themes/simple/css/searxng.css @@ -2369,9 +2369,15 @@ article.result-images .detail { } #search_logo { grid-area: logo; + display: flex; + align-items: center; + justify-content: center; } -.search_logo_img { - width: 40px; +#search_logo svg { + flex: 1; + width: 30px; + height: 30px; + margin: 0.5rem 0 auto 0; } .search_categories { grid-area: categories; diff --git a/searx/static/themes/simple/css/searxng.min.css b/searx/static/themes/simple/css/searxng.min.css index 1a3b0737..8e88a67b 100644 Binary files a/searx/static/themes/simple/css/searxng.min.css and b/searx/static/themes/simple/css/searxng.min.css differ diff --git a/searx/static/themes/simple/css/searxng.min.css.map b/searx/static/themes/simple/css/searxng.min.css.map index e66f38f1..eb8019d6 100644 Binary files a/searx/static/themes/simple/css/searxng.min.css.map and b/searx/static/themes/simple/css/searxng.min.css.map differ diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js index 325a973b..f10d00cf 100644 --- a/searx/static/themes/simple/gruntfile.js +++ b/searx/static/themes/simple/gruntfile.js @@ -9,7 +9,7 @@ module.exports = function(grunt) { watch: { scripts: { files: ['src/**'], - tasks: ['eslint', 'copy', 'concat', 'uglify', 'less:development', 'less:production'] + tasks: ['eslint', 'copy', 'concat', 'uglify', 'htmlmin', 'less:development', 'less:production'] } }, eslint: { @@ -95,6 +95,17 @@ module.exports = function(grunt) { } } }, + htmlmin: { + dist: { + options: { + removeComments: true, + collapseWhitespace: true + }, + files: { + '../../../templates/__common__/searxng-wordmark.min.svg': 'src/svg/searxng-wordmark.svg' + } + } + }, webfont: { icons: { // src: 'node_modules/ionicons-npm/src/*.svg', @@ -191,6 +202,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-htmlmin'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-less'); @@ -207,6 +219,7 @@ module.exports = function(grunt) { 'copy', 'concat', 'uglify', + 'htmlmin', 'less:development', 'less:production' ]); diff --git a/searx/static/themes/simple/img/favicon.png b/searx/static/themes/simple/img/favicon.png index 36be5fc0..5d5b761d 100644 Binary files a/searx/static/themes/simple/img/favicon.png and b/searx/static/themes/simple/img/favicon.png differ diff --git a/searx/static/themes/simple/package.json b/searx/static/themes/simple/package.json index 4b0ffc4f..4ef608db 100644 --- a/searx/static/themes/simple/package.json +++ b/searx/static/themes/simple/package.json @@ -8,6 +8,8 @@ "grunt-contrib-jshint": "~3.1.1", "grunt-contrib-less": "~3.0.0", "grunt-contrib-uglify": "~5.0.1", + "grunt-xmlmin": "~0.1.8", + "grunt-contrib-htmlmin": "~3.1.0", "grunt-contrib-watch": "~1.1.0", "grunt-stylelint": "^0.16.0", "grunt-eslint": "^23.0.0", diff --git a/searx/static/themes/simple/src/less/search.less b/searx/static/themes/simple/src/less/search.less index fddd2b35..b4818ba5 100644 --- a/searx/static/themes/simple/src/less/search.less +++ b/searx/static/themes/simple/src/less/search.less @@ -18,10 +18,16 @@ #search_logo { grid-area: logo; -} + display: flex; + align-items: center; + justify-content: center; -.search_logo_img { - width: 40px; + svg { + flex: 1; + width: 30px; + height: 30px; + margin: 0.5rem 0 auto 0; + } } .search_categories { diff --git a/searx/static/themes/simple/src/svg/searxng-wordmark.svg b/searx/static/themes/simple/src/svg/searxng-wordmark.svg new file mode 100644 index 00000000..b94fe372 Binary files /dev/null and b/searx/static/themes/simple/src/svg/searxng-wordmark.svg differ diff --git a/searx/templates/__common__/searxng-wordmark.min.svg b/searx/templates/__common__/searxng-wordmark.min.svg new file mode 100644 index 00000000..688b6f51 Binary files /dev/null and b/searx/templates/__common__/searxng-wordmark.min.svg differ diff --git a/searx/templates/simple/search.html b/searx/templates/simple/search.html index f8c82cd1..1f410ad9 100644 --- a/searx/templates/simple/search.html +++ b/searx/templates/simple/search.html @@ -1,6 +1,7 @@