From edb081638ba2f3f40fb2e4f5a73aafdacbfc0424 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 7 Nov 2021 14:53:26 +0100 Subject: [simple theme] SearXNG wordmark (SVG) Related-to: - https://github.com/searxng/searxng/pull/430#issuecomment-951967239 - https://github.com/searxng/searxng/pull/378 Signed-off-by: Markus Heiser --- .../themes/simple/src/svg/searxng-wordmark.svg | 90 ++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 searx/static/themes/simple/src/svg/searxng-wordmark.svg 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 000000000..9f1000365 --- /dev/null +++ b/searx/static/themes/simple/src/svg/searxng-wordmark.svg @@ -0,0 +1,90 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + -- cgit v1.2.3 From bf52353a5c3d0ba7bebde209c916d492fe521159 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 7 Nov 2021 16:45:00 +0100 Subject: [enh] minify searxng-wordmark.svg (HTMLMinifier) Command:: ./node_modules/.bin/html-minifier \ --remove-comments \ --collapse-whitespace \ src/svg/searxng-wordmark.svg \ -o ../../../templates/__common__/searxng-wordmark.min.svg - html-minifier: https://github.com/kangax/html-minifier - onilne: https://kangax.github.io/html-minifier - grunt: https://www.npmjs.com/package/grunt-contrib-htmlmin - grunt-contrib-htmlmin: https://github.com/gruntjs/grunt-contrib-htmlmin - npm: https://www.npmjs.com/package/html-minifier To test, rebuild your node environment:: make node.env Alternatives: - pretty-data: https://github.com/vkiryukhin/pretty-data - grunt: https://www.npmjs.com/package/grunt-xmlmin - grunt-xmlming: https://github.com/dtrunk90/grunt-xmlmin - npm: https://www.npmjs.com/package/grunt-xmlmin - minify-xml: https://github.com/kristian/minify-xml - no grunt package available - npm: https://www.npmjs.com/package/minify-xml src/svg/searxng-wordmark.svg': '../../../templates/__common__/searxng-wordmark.min.svg' Signed-off-by: Markus Heiser --- searx/static/themes/simple/gruntfile.js | 15 ++++++++++++++- searx/static/themes/simple/package.json | 2 ++ searx/templates/__common__/searxng-wordmark.min.svg | 1 + utils/lib_static.sh | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 searx/templates/__common__/searxng-wordmark.min.svg diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js index 325a973b4..f10d00cf3 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/package.json b/searx/static/themes/simple/package.json index 4b0ffc4fd..4ef608db7 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/templates/__common__/searxng-wordmark.min.svg b/searx/templates/__common__/searxng-wordmark.min.svg new file mode 100644 index 000000000..35b4cac25 --- /dev/null +++ b/searx/templates/__common__/searxng-wordmark.min.svg @@ -0,0 +1 @@ + image/svg+xml \ No newline at end of file diff --git a/utils/lib_static.sh b/utils/lib_static.sh index 0d4ba9bad..b88b9b6cf 100755 --- a/utils/lib_static.sh +++ b/utils/lib_static.sh @@ -11,6 +11,7 @@ STATIC_BUILT_PATHS=( searx/static/themes/simple/css searx/static/themes/simple/js searx/static/themes/simple/src/generated/pygments.less + searx/templates/__common__/searxng-wordmark.min.svg ) static_help(){ -- cgit v1.2.3 From 3a981257de1c70dd8582eb8ddd9616b547a1cfca Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 8 Nov 2021 09:55:16 +0100 Subject: [simple theme] create favicon.png from src/svg/searxng-wordmark.svg new bash function convert_if_newer() / usage:: convert_if_newer [, ...] convert_if_newer "path/to/origin.svg" "path/to/converted.png" -transparent white -resize 64x64 Run's ImageMagik' convert comand to generate from , if is newer than . The command line is to convert is:: convert [, ...] PNG 'searx/static/themes/simple/img/favicon.png' has been created by:: $ make themes.simple CONVERT searx/static/themes/simple/src/svg/searxng-wordmark.svg -transparent white -resize 64x64 searx/static/themes/simple/img/favicon.png ... Signed-off-by: Markus Heiser --- manage | 38 +++++++++++++++++++++++++++-- searx/static/themes/simple/img/favicon.png | Bin 1474 -> 4734 bytes utils/lib_static.sh | 1 + 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/manage b/manage index daa7171da..07761e76c 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/img/favicon.png b/searx/static/themes/simple/img/favicon.png index 36be5fc01..409ede8ab 100644 Binary files a/searx/static/themes/simple/img/favicon.png and b/searx/static/themes/simple/img/favicon.png differ diff --git a/utils/lib_static.sh b/utils/lib_static.sh index b88b9b6cf..35fdbd7de 100755 --- a/utils/lib_static.sh +++ b/utils/lib_static.sh @@ -11,6 +11,7 @@ STATIC_BUILT_PATHS=( searx/static/themes/simple/css searx/static/themes/simple/js searx/static/themes/simple/src/generated/pygments.less + searx/static/themes/simple/img/favicon.png searx/templates/__common__/searxng-wordmark.min.svg ) -- cgit v1.2.3 From ee67a65180cd5cb4faeda310c6c6af10391435b6 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 8 Nov 2021 11:05:02 +0100 Subject: [simple theme] replace old searx logo by searxng-wordmark.min.svg Suggested-by: @dalf https://github.com/searxng/searxng/pull/473#issuecomment-962476683 Suggested-by: @MrPaulBlack https://github.com/searxng/searxng/pull/473#issuecomment-962579826 Signed-off-by: Markus Heiser --- searx/static/themes/simple/src/less/search.less | 12 +++++++++--- searx/templates/simple/search.html | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/searx/static/themes/simple/src/less/search.less b/searx/static/themes/simple/src/less/search.less index fddd2b357..b4818ba5d 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/templates/simple/search.html b/searx/templates/simple/search.html index f8c82cd1b..1f410ad96 100644 --- a/searx/templates/simple/search.html +++ b/searx/templates/simple/search.html @@ -1,6 +1,7 @@