""" ================================================================================ user_configs.py, part of thumbspage [added in 1.6, expanded thereafter] Change the Python-coded default settings here to configure thumbspage results. These are lesser-used options, beyond per-run console inputs, but easier to tailor than custom HTML. For more advanced customizations, the index page can also be customized with HEADER.html and FOOTER.html insert files, and the viewer-page template file can be edited freely (but may be best left intact). For example, a HEADER.html can code a custom message, whole-page font, and thumbs-table font for the index page. Include CSS style blocks to set fonts: - for the whole page - for just labels in fixed layout - for labels in dynamic layout See the examples/ folder here for HEADER.html and other usage examples, and consult UserGuide.html#Customization for more on advanced techniques. Programmers, for example, might be interested in search-and-replace tags. General usage notes: - When upgrading, be careful to save and reinstall your edits to this file. - If needed, there is a backup copy of this file's shipped version in docetc/. - Most newer settings appear later in this file, but search by release #s too. - Always use Python's True and False here, not JavaScript's true and false. Update: as of version 2.2, config settings in this file can be overridden on a per-build basis with command-line arguments of the form "setting=value". See UserGuide.html#configcmdargs22 for complete coverage of this alternative. Args are applied after this file is imported, and cannot name other settings. Update: as of 2.3, this file and command arguments can also provide values normally input in the console. Precedence: argument, then here, then input (i.e., arguments override settings here, and inputs are tried iff no other). Special: if the first command arg is image folder, it overrides all others. ================================================================================ """ #------------------------------------------------------------------------------- # Output folder/file names #------------------------------------------------------------------------------- # # THUMBS is the name of a subfolder within the image folder, where both # thumbnail images and viewer pages are stored. INDEX is the name of the # index page created in the image folder; ".html" is appended automatically. # THUMBS should start with a "_" or "." to omit it from index-page subfolder # lists, and is also used for the limited GUI-mode viewer's folder as of 2.1. # Viewer pages in THUMBS always open ../INDEX.html on Index-button taps. #------------------------------------------------------------------------------- THUMBS = '_thumbspage' # built subfolder name (thumbs+viewers) INDEX = 'index' # built index-page name ('default'?, 'home'?) #------------------------------------------------------------------------------- # Code-generation options: index page #------------------------------------------------------------------------------- # Assorted settings added in assorted releases (mostly in [1.5] and earlier). # These mostly pertain to the index page; viewer pages use an editable template. # uniformColumns is not used if 2.1's dynamic layout option is enabled ahead. # # # The ORDER.txt alternative: # # [3.0] As of 3.0, the optional file ORDER.txt provides an alternative and # explicit way to specify image-file order that overrides filename ordering. # If present in the images folder, this file lists one image filename per line # (unquoted, and omitting folder paths but including .xxx extensions). Its # top-to-bottom order is the order in which the gallery presents listed images # and is used for both the index page and viewer-page navigation. An ORDER.txt # example: # # filenameZ.jpg # filenameY.png # filenameX.JPG # # Any images not listed in ORDER.txt are still ordered by filename subject to # caseSensOrder below, and appear after all images ordered per ORDER.txt. # Note that this orders image files only; auto subfolder links are always # alphabetical, subject to caseSensOrder (see listSubfolders). # # Ordering always uses case-sensitive matching of filenames on all build hosts, # this file's Unicode encoding is per config insertEncoding elsewhere here. # To catch spelling and other mistakes, a "*CAUTION" is printed for entries # in the ORDER.txt file that don't name a real image filename. # # Tip: ORDER.txt is not required if image filenames have a natural order. # Years, camera-assigned numbers, etc., can make filenames sufficient. But # ORDERS.txt can be more convenient than numbering filenames manually and # doesn't rely on photo EXIF tags, unreliable or unavailable in some contexts. #------------------------------------------------------------------------------- # Fixed-layout index uniformColumns = True # same-width columns? (else by content) # Auto subfolder-links list listSubfolders = True # show folder-links list? (or do via header) subfolderSpacer = '7px' # CSS space between folder links, 6px->7px [2.1] # Assorted additions useViewPort = True # add mobile-friendly viewport? caseSensOrder = True # index/nav order is case sensitive? # Defunct: always on as of [1.5], for fixed-layout table borders # spanFullWindow = False # stretch table to window's width? #------------------------------------------------------------------------------- # Colors: index- and viewer-page background, foreground, etc. (also Top ahead) #------------------------------------------------------------------------------- # Set Border=Bg color to omit index image borders. Use any web color name or # a #RRGGBB hex string (e.g., 'ivory', '#633025' (a brown), '#008080' (a teal)). # These settings were added across versions [1.5] and [1.6], though all were # new in [1.6] except the Bg colors, and [2.0] extended viewer colors to info. # # [2.2] Preset thumbsBgColor slightly darker for contrast: #f5f5f5 => lightgrey; # for something in between the old and the new, try #eeeeee or similar. # # [2.3] Add popup*Color for info and Note popup dialogs in viewer pages; # if None (preset), these inherit the viewer* page-wide settings as before; # else, they apply to both info and Note popups; subtlety: popup OK buttons # use the popup border setting here, but for symmetry always take their bg/fg # colors from the page, not the popup; see also UserGuide.html#popupcolors23. # # [2.3] Add popupOpacity for dimness of background when popups appear; brighter # (lower) is good when notes reference images, but darker (higher) may be better # when notes are longer or images are very bright and may clash with notes. # The preset 0.40 means 40% opaque, the same as in prior thumbspage versions. # # [3.0] popupOpacity's preset changed from 0.40 to 0.45 (slightly darker, per # usage), and popupFgColor's preset changed from None to 'wheat' (for better # readability on black). Please update any galleries that depend on these. # # [3.0] popupLinksColor, new in 3.0, colorizes any hyperlinks nested as # escaped HTML tags in viewer pages' Note text (see tag docs ahead). # If set to None, links inherit color from the note-wide popupFgColor. # Can differ from viewerFgColor (used for all viewer-page text/borders) # and popupFgColor (used for Note and info text), and can be overridden # to differ in dark theme (via darkThemeLinksColor + useCannedDarkTheme). # # [3.0] The two new index*Color settings now allow you to set the Bg/Fg # colors for the entire index page when using default headers (only). The # former thumbs*Color are for just the thumbnails table embedded in the # index page, as before. Full-page colors could formerly be set via CSS # code in a custom header, but they were made configs here in 3.0 for parity # with their new darkThemeIndex*Color counterparts used in dark-mode (ahead). # These don't apply to a custom HEADER.html: define body colors manually. #------------------------------------------------------------------------------- # Index page indexBgColor = 'white' # index page background color (light) [3.0] indexFgColor = 'black' # index page foreground color (dark) [3.0] thumbsBgColor = 'lightgrey' # thumbs table background color ([2.2]) thumbsFgColor = 'black' # thumbs table foreground: filename thumbsBorderColor = thumbsFgColor # index-page thumbnail border color (=Fg?) # Image-viewer pages (and formerly, their info popups [2.0]) viewerBgColor = '#333' # viewer pages background color viewerFgColor = 'white' # viewer pages foreground: filename, buttons viewerJSColor = 'red' # no-JavaScript note text color viewerBorderColor = viewerFgColor # viewer-page image border color (=Fg?) # Viewer-page info, note, and message popups (note uses these too [2.3]) popupBgColor = None # box (None = use viewerBgColor; e.g., 'darkgrey' popupFgColor = '#e0e0e0' # text (None = use viewerFgColor; e.g., '#e0e0e0' popupBorderColor = None # border (None = use viewerBorderColor; e.g., '#222' popupLinksColor = 'cyan' # links (None = use popupFgColor [3.0]) # Viewer-page: opacity (dimness) of background for info and Note popup overlays [2.3] popupOpacity = 0.45 # higher = dimmer (darker) background (0.0..1.0) # See also Top button colors ahead, darkTheme* counterparts ahead [3.0] #------------------------------------------------------------------------------- # Stretch smaller images beyond actual size on viewer pages? [1.6] #------------------------------------------------------------------------------- # If True, this expands images smaller than the display to fill all # viewer-page space. This works, but it can make small images blurry. #------------------------------------------------------------------------------- expandSmallImages = False # True = show larger, but may be blurry #------------------------------------------------------------------------------- # Unicode text-file settings (generally best unchanged) [1.6] #------------------------------------------------------------------------------- # insertEncoding # Used for loading index-page header/footer insert files. # None=default platform encoding; 'UTF-8' also handles ASCII. # The generated index page is encoded per outputEncoding. # # outputEncoding # Used for all generated page content, and default HTML tags. # Use a real encoding name (not None); 'UTF-8' works for all text. # Not used for URL encoding: this is always UTF-8 (see url_escape()). # Encoding in a HEADER.html tag should match outputEncoding. # # templateEncoding # Used for loading the viewer-page template file, "template-viewpage.html". # The resulting viewer pages generated are encoded per outputEncoding. # # [2.0] templateEncoding is now also used to load the floating Top button's # "template-floatingtop.html" (added to index pages per outputEncoding). # # [3.0] templateEncoding is now also used for template-autothemes.html, # used to define a dark theme if useCannedDarkTheme is set (see ahead). # # noteEncoding # [2.3] Used for loading ".note" Note text files (see useImageNotes ahead). # [3.0] The new NOTES.py file is Python code that uses UTF-8, per ahead. # # Other encodings: # # [3.0] insertEncoding is now also used for the new optional config file # ORDER.txt (image ordering). Files CAPTIONS.py (image labels) and NOTE.py # (image notes) always use UTF-8 encoding per Python convention because they # contain code. For more info, see UserGuide.html or search for "3.0" here. #------------------------------------------------------------------------------- insertEncoding = 'UTF-8' # index-page header/footer files outputEncoding = 'UTF-8' # used for all generated pages templateEncoding = 'UTF-8' # viewer-page+Top template files [2.0] noteEncoding = 'UTF-8' # imagename.note Note text files [2.3] #------------------------------------------------------------------------------- # Turn off disable for image-history destacking for Chrome on iOS (temp)? [1.6] #------------------------------------------------------------------------------- # Chrome on iOS (only) has a bug in its location.replace(), which requires # disabling thumbspage's viewer-page history destacking feature in this browser # alone. Set to True if ever fixed. See 1.6 notes in UserGuide and JS code. # Update: still broken in May 2020's iOS Chrome 75; True here stacks all pages. # # Update: iOS Chrome's behavior is not fixed, but is now no different than the # work-around; default to True here to skip the work-around. Navigation pages # will be stacked on iOS Chrome until it's fixed (or this switch is changed). # # Update: this iOS Chrome history bug was eventually fixed, as of Chrome 83 # in June 2020 (and perhaps earlier). The True setting below adopts the fix, # which no longer stacks navigation pages in browser history--as intended. #------------------------------------------------------------------------------- chromeiOSBackFixed = True # True = stop disabling the work-around #------------------------------------------------------------------------------- # Automatic right-side up image and thumbnail orientation (best unchanged) [1.6] #------------------------------------------------------------------------------- # If autoRotateImages is True, images and their thumbnails are automatically # rotated as needed to display their top side on top. If backupRotatedImages # is True, any rotated images are saved to backup copies in the images folder # with ".original" extensions before any changes are made. To restore originals # from backups, run "docetc/restore-prerotate-originals.py". Auto-rotation # works only for some image types and cameras/tools, and is just an automatic # alternative to manually rotating tilted images before running thumbspage. # # [2.1] thumbspage now automatically deletes embedded thumbnail images on # rotations by default, because these were not adjusted for rotations and # could cause issues in other tools (e.g., some file explorers displayed # skewed thumbnails for images recorded on some devices). # # This deletion is generally harmless: embedded thumbnails are not used by # thumbspage, and other tools simply fall back on their handling for images # that never had embedded thumbs in the first place. But if you're sure # this isn't a concern for your images, you can set deleteEmbeddedThumbs to # False to avoid the removal. If you do, originals, including their embedded # thumbnails, can be restored from ".original" backups if tools ever skew # thumbs of rotated images. For more info, see this program's 2.1 demo: # examples/console-logs/2.1-embedded-thumbs-removal.txt. #------------------------------------------------------------------------------- autoRotateImages = True # False = no auto rotations attempted backupRotatedImages = True # False = no ".original" backup copies deleteEmbeddedThumbs = True # False = retain embedded thumbnails [2.1] #------------------------------------------------------------------------------- # Use pre-1.7 CSS-based display, not JS scaling, for iOS Safari landscape? [1.7] #------------------------------------------------------------------------------- # As of 1.7, thumbspage uses JavaScript image scaling for landscape orientation # in all browsers. This works well everywhere, including iOS Safari as long as # users enable the toolbar-hiding option added in iOS 13. On devices not using # the iOS 13 option, the landscape scaled display requires a minor scroll in # Safari, but is better than the former CSS-based scaling. For compatibility, # a True here reenables the pre-1.7 CSS-based landscape display for iOS Safari. #------------------------------------------------------------------------------- iOSSafariLandscapeCSS = False # True = use former legacy display #------------------------------------------------------------------------------- # Don't upscale/boost index-page text in iOS Safari landscape orientation? [1.7] #------------------------------------------------------------------------------- # As of 1.7, thumbspage emits a "-webkit-text-size-adjust" style in default # thumbnail index pages, to disable iOS Safari upscaling (a.k.a. size boosting) # for some text in landscape orientation. This allows more text to be viewed, # and is new in index-page default headers only. To restore prior behavior, # use either False below, or a custom HEADER.html file without the new style. #------------------------------------------------------------------------------- noiOSIndexTextBoost = True # False = upscale index-page text #------------------------------------------------------------------------------- # Per-gallery delay between image-viewer pages for automatic slideshows [2.0] #------------------------------------------------------------------------------- # As of 2.0, thumbspage image-viewer pages implement an automatic slideshow # that advances to the next image after a fixed delay. The delay cannot be # changed by gallery users, but can vary per generated gallery: set it here # before build, with a milliseconds-delay value (e.g., 3000 is 3 seconds, # and 100 is fun but probably too fast for anything but a strobe light). # # Note: the previous/next buttons work during, and do not cancel, slideshows # in progress; the slideshow toggle and most gallery exits cancel slideshows. # # [2.1] The preset delay was changed from 5 seconds to 4 here initially, but # changed back to 5 seconds (5000 msecs) late in the 2.1 project. This is a # delicate tradeoff: longer delays seem better for galleries not yet seen; # shorter works well for revisits and avoids seeming stuck when a show first # starts; but too short can appear chaotic (and 4 seconds seemed to qualify). # Your galleries may vary, and users can always tap Auto to pause on an image. #------------------------------------------------------------------------------- autoSlideShowDelayMS = 5000 # milliseconds between pages in slideshows #------------------------------------------------------------------------------- # Disable or configure the floating "Top" button displayed on index pages [2.0] #------------------------------------------------------------------------------- # As of 2.0, thumbspage generates index-page code to display a floating # Top button that jumps to page top when clicked/tapped. This is intended # for larger indexes that have useful content at page top, and is more useful # on mobile than desktop browsers to minimize scrolls. Settings here can omit # the button in a given gallery, tailor the scroll location at which it first # appears, and specify its distance from page bottom to allow for toolbars. # For background and foreground colors, use any web name or #RRGGBB hex string. # # Note: when using a custom FOOTER.html, you may need to add margin spacing # below its last content line, to prevent the Top button from covering it # (e.g.,

- see template-floatingtop.html). #------------------------------------------------------------------------------- floatingTopEnabled = True # True = emit code for floating Top floatingTopAppearAt = 500 # show Top when scroll to this pixel offset+ floatingTopSpaceBelow = 36 # Top's pixel offset from page bottom floatingTopFgColor = 'white' # foreground: any 'name' or '#RRGGGBB' hex string floatingTopBgColor = '#999' # which is #999999, which is rgb(153, 153, 153): grey #------------------------------------------------------------------------------- # Enable Full fullscreen toggle button in image-viewer toolbars (limited)? [2.0] #------------------------------------------------------------------------------- # As of 2.0, thumbspage viewer page toolbars can optionally have a Full button # which toggles fullscreen display on and off for that page - only. Because # this lasts for just one page and is unsupported on some platforms (e.g., iOS), # this feature can be disabled here (it's on by default as a demo). Users can # manually enable a fullscreen mode in some browsers that spans pages (e.g., all # pages visited during an Auto slideshow); see UserGuide.html#fullscreenmanual. #------------------------------------------------------------------------------- showFullscreenButton = True # True = show Full button on viewer pages #------------------------------------------------------------------------------- # Thumbnail auto and/or manual enhancements, drop noise and blur as preset [2.1] #------------------------------------------------------------------------------- # As of 2.1, the following settings can be used to customize enhancements for # generated thumbnail images. Both three precoded (auto) and five arbitrary # (manual) settings are available; you can freely use zero or more from each # set below, though some auto settings are redundant with some manual settings # (e.g., you probably want to disable auto sharpen when using manual sharpen). # # As shipped, the True preset defaults below (1) increase save quality to # avoid minor loss/noise in some JPEG thumbs, which stems from compression, # and is most noticeable at higher browser zooms; and (2) sharpen all thumbs # by a fixed amount to negate the blurring that's inherent in the underlying # image library's thumbnail resizes, even for its best resampling filter. # Both of these preset enhancements improve thumbnail appearance noticeably # in all galleries and on all displays tested. # # The presets can also increase the space required for thumbs, but only by a # trivial amount: for an example 112-image gallery, thumbnail folders (HTML # files + images) take up 6M with no enhancements or just sharpening; 6.6M # with just higher quality; and 6.7M with boosted quality and sharpening. # The space used by all thumbnail images alone is only around 1M in all cases. # Sharpening can also yield rare and minor noise in some images at higher # browser zooms, but its extra clarity seems well worth its tradeoffs. # # Still, if the presets' space or noise tradeoffs prove unwanted for your use # case, turn off the autos, and set manual options instead as desired. Simply # changing the two presets from True to False, for instance, restores 2.0 # thumbnails. For more details on the underlying library's usage of manual # factors, either experiment with values, or see the image library's docs: # # https://pillow.readthedocs.io/en/stable/ # reference/ImageEnhance.html?highlight=ImageEnhance # https://pillow.readthedocs.io/en/stable/ # handbook/image-file-formats.html?highlight=quality # # The auto quality and sharpen options, for example, use 100 and 2 for the # corresponding manual factors, but manual factors support ranges of values. # Quality is applied on saves; all others are applied to thumbs in memory. # # Caveat: in 2021, sharpness doesn't seem to help WebP and some GIFs; YMMV. # Tip: when in doubt, try it out; the impacts of these can vary per gallery. #------------------------------------------------------------------------------- # AUTO enhancements: precoded common changes, use one or more. # The first two are preset to True to remove JPEG noise and sharpen all thumbs; # they should probably stay True unless they cause issues in your galleries. thumbsAutoHighQuality = True # True = no JPEG compression noise (default) thumbsAutoSharpen = True # True = all images are less blurry (default) thumbsAutoBlackWhite = False # True = remove all color (precoded b&w mode) # MANUAL enhancements: use one or more instead of or in addition to autos. # In all five: None=ignore, number=apply (integer or float). # In the last four: 1.0=original, < 1.0 is less, > 1.0 is more. thumbsManualQualityFactor = None # 0 (worst)..100 (best), None=default=75 (jpeg) thumbsManualSharpnessFactor = None # 0.0=blur, 1.0=original, 2.0=sharpen, >2=sharper thumbsManualContrastFactor = None # 0.0=solid grey, 1.0=original, >1.0=vivid thumbsManualColorFactor = None # 0.0=black&white, 1.0=original, >1.0=saturated thumbsManualBrightnessFactor = None # 0.0=black, 1.0=original, >1.0=brighter #------------------------------------------------------------------------------- # Dynamic index-page layout for thumbnail links (optional, experimental) [2.1] #------------------------------------------------------------------------------- # As of 2.1, thumbspage provides two ways to layout the thumbnail links on index # pages: (1) the original fixed model, which renders a preset number of columns # in all contexts, and (2) a new dynamic model, which arranges thumbnail # columns to match page size, and rearranges them on page resizes. # # The dynamic model qualifies as "responsive" web design, as it adjusts to the # size and shape of the display. (Viewer-page image scaling is also responsive). # # The new dynamic mode uses available space well on desktop browsers and avoids # some minor horizontal scrolling on mobile, but can be less than ideal on # mobile: phones may display a single long column, which can require much more # vertical scrolling, and much more navigation work overall. # # Because of this, and other tradeoffs discussed in the User Guide's 2.1 note, # the new dynamic layout is an experimental alternative in 2.1. To enable it # for your galleries, set the first switch below to True; its False preset # selects the original and still default fixed-layout scheme. # # If you opt to enable dynamic layout, you can also customize the amount # of padding space around each thumbnail, with the other two settings here: # PaddingH is horizontal (left+right) and PaddingV is vertical (above+below). # Both are cumulative: '8px' means 8 pixels on both sides, and for each cell. # Use any CSS size unit (e.g., '0px', '8px', '1em'). Smaller values squeeze # thumbs closer together, and larger spreads them out more. Padding here is # is always applied to cells, though the horizontal spacing also depends on # how wide your gallery's image-filename labels are compared to its thumbnails: # filename labels dominate the horizontal layout if wider than thumbnail images. # # [2.3] The dynamic horizontal layout scheme now packs columns closer # together when labels are wider than images. This render more than one # column for some galleries on some mobiles. The default presets here were # unchanged, but can be freely decreased for tighter fit, or increased to # compensate for undersizing. See UserGuide.html#dynamiclayout23. # # [2.3] If you omit filename labels with omitIndexPageLabels ahead, the # two padding settings here allow you to space out thumbnails better. A # '16px' for both is recommended, but may be subpar if labels are present. # # [3.0] Dynamic (a.k.a. responsive) index-page layout is now the default, # because it both has been battle tested and is generally better across a # range of devices. This may break build scripts that use precoded console # input because #columns/row is not asked for dynamic mode; mod as desired. # Also changed presets for dynamicLayoutPaddingH/V from 8px/15px to 6px/6px # to conserve space on index pages; configure here or in cmd args as needed. #------------------------------------------------------------------------------- useDynamicIndexLayout = True # True = dynamic layout, False = fixed layout dynamicLayoutPaddingH = '6px' # horizontal space around thumbs (0px=close) dynamicLayoutPaddingV = '6px' # vertical space around thumbs (32px=distant) #------------------------------------------------------------------------------- # Touch: meaning of left/right swipes for touch gestures [2.2] #------------------------------------------------------------------------------- # As of 2.2, image-viewer pages support left/right and up/down gestures in the # image-display area (not the entire page) on touch displays. Up/down invoke # the info dialog and raw image view, respectively. Left/right move to the # previous or next image in the gallery, per the following setting's value: # # If True: left=Prev, right=Next # matches the Prev/Next buttons on the toolbar # # If False: left=Next, right=Prev # uses the opposite and common "natural" order (and is default) # # Swipes are just alternatives to taps on widgets, and work on mobiles and PCs. # Widget taps still work as before, including taps on images for raw views. # # [3.0] Note that the physical direction of swipes may depend on users' # system settings. That is, the meanings of left/right and up/down may be # inverted by system settings--and modulated by the following for left/right. # # [3.0] Swipes now also work on touchpads and mousewheels, in addition to # the original touchscreen support. They work the same as for touchscreens. #------------------------------------------------------------------------------- lrSwipesPerButtons = False # swipe left/right in direction of Prev/Next buttons? #------------------------------------------------------------------------------- # Touch: enable up-swipe in browsers that didn't formerly support it? [2.2] #------------------------------------------------------------------------------- # As of 2.2, up-swipe is implemented only for Firefox on Android and Windows, # all browsers on iOS, and Samsung Browser on Android. Other browser and # platform combos, most notably Chrome and its Edge and Opera relatives on # Android and Windows, have a glitch which makes it impossible to return to # the gallery's image-viewer page with Back after an up-swipe to raw view. # # Because Chrome has history of fixing bugs (see chromeiOSBackFixed earlier in # this file), you can set the following switch to True to both test if this # bug has been fixed, and enable up-swipe on all browsers. thumbspage may be # rereleased for such a fix, but this switch can accommodate it earlier. # See UserGuide.html#chromeupswipebug22 for more info on the glitch. # # [2.3] UPDATE: This setting is now IGNORED if useImageNotes (below) is True # and any ".note" files exist. If so, up-swipe is now always the same as a # tap on the new Notes button, and opens the image's text note, if it has one. # Else, up-swipe is raw view as in 2.2 (with the same browser-specific quirks). #------------------------------------------------------------------------------- upSwipeOnAllBrowsers = False # has Chrome fixed its Back-after-Up bug yet? #------------------------------------------------------------------------------- # Use tooltip hover popups? [2.2] #------------------------------------------------------------------------------- # If and only if the following setting is True, both index and viewer pages # will include "title" attributes, which trigger a tooltip text popup when # a mouse hovers over an image (on index and viewer pages), and filename and # Auto and Full buttons (on viewer pages). Tooltips don't appear on mobile, # and their text is short (e.g., "View image") but they may be distracting and # pointless after some use. Hence, they're off as preset; enable with True. # # [2.3] Changed to be ENABLED per default preset; with the new Note button, # viewer pages have grown complex enough to warrant the tips (where supported). # There now are also tooltips on the Prev/Next/Index buttons for consistency. #------------------------------------------------------------------------------- useToolTips = True # add 'title' attributes for tooltip hover popups? #------------------------------------------------------------------------------- # Show default-footer tagline on index pages? [2.2] #------------------------------------------------------------------------------- # Index pages that are not built with a custom FOOTER.html file have always # included a brief tagline at the end (e.g., "Gallery built by thumbspage.py" or # "Page built by thumbspage.py"), with a link to this program's web page. As # this is a mild form of advertising, the tagline can now be omitted by setting # the following switch to False. It can also be omitted by using a basic custom # footer as before; this is just an automated scheme for default-footer pages. #------------------------------------------------------------------------------- defaultFooterTagline = True # thumbspage plug at end of default pages? #------------------------------------------------------------------------------- # Note button + display for viewer pages [2.3] #------------------------------------------------------------------------------- # Text notes allow you to provide plain-text descriptions for some or all # of the images in your galleries. The useImageNotes setting below, or its # command-line argument equivalent, enables this as follows: # # If useImageNotes is False OR no images have .note files: # - No Note buttons are displayed in viewer-page toolbars # - Any .note files in the images folder are ignored # - Up-swipes work as they did in 2.2, opening raw-image views # # If useImageNotes is True AND any image has a .note file: # For images with a .note file: # - The viewer page shows a Note button with normal font and color # - Note taps pop up the .note file's content as plain text # - Up-swipes also open the note file's content, not raw-image views # For images without a .note file: # - The viewer page still shows a Note button, but with line-through # - Note taps and up-swipes work, but show default text "(No note)" # # # How to code notes: # # To code a note for an image, create a text file with a ".note" extension # in the main images folder, alongside the image itself. For example, make # "images/photo.jpg.note" to give the Note text for "images/photo.jpg". # # The popup collapses all text in the ".note" file into a single paragraph, # except that an empty line (i.e., two adjacent line breaks, '\n\n') is # treated as a paragraph break in the popup, and renders as a blank line. # # Any Unicode character can appear in the file, including emojis. Both # HTML and JavaScript special characters can be used freely; they do not # impact the note's text, and render literally as given (e.g., "" does # not produce a link, and quotes and backslashes do not modify text). # Notes scroll vertically if too tall, but should be short as a guideline. # # # Special cases: # # If there are no ".note" files in the images folder at build time, this # feature is automatically disabled by the system for the gallery build. # This avoids showing Note buttons on viewer pages which would all be no-ops. # Hence, useImageNotes is used only if at least one ".note" file exists. # # If this feature is enabled, up-swipe on touch screens is the same as tapping # a Note button, and opens the note; use image taps for raw-image views. # Notes don't stay up during Auto slideshows, as images would be obscured. # Related: see also noteEncoding and upSwipeOnAllBrowsers settings above. # # Also here: noteBoxVSpace defines how much empty space appears to the left # and right of the note box. The preset 15% makes the box fill 70% of the # page (100% - (15% * 3)), and is a reasonable compromise between mobile # (where larger is better) and desktop (where the box expands and shrinks # with the window). Use smaller settings for wider notes on mobile, and # any size type (e.g., arg noteBoxVSpace=\'10%\', here noteBoxVSpace='5px'). # # See also: popup*Color settings above for Note (and info) box background, # foreground (text), and border colors. They still inherit from the viewer # page as preset, but can now be tailored to vary from the enclosing page. # The original white on black may be difficult to read on some displays. # # # Embedding HTML tags and entities: # # [3.0] As of 3.0, image notes may include embedded HTML tags and entities # that are passed along to browsers unchanged in viewer pages. These are # coded with a leading underscore to escape the tag or entity, and work for # note text in both ".note" files and the NOTES.py dictionary (ahead). # # Tags allow notes to use "" for hyperlinks, "" and "" for bold and # italics, "


" for divider lines, "
for line breaks, "" for # colors and fonts, " # Coding _note_ text with _style_ # # To embed an entity in a note, prefix it with an underscore the same way: # _— _< _  _¥ _< _👍 _👍 # # All note characters outside "_<...>" and "_&...;" sequences are rendered # verbatim as before and not interpreted as HTML syntax. Tags embedded in # note text may span multiple lines freely (e.g., _
); # any embedded newlines are treated normally per the host's HTML processor. # # Because notes become mini web pages with the addition of embedded tags, # they also now stay open for further reading until explicitly closed, even # after navigating to another image or using a browser's back button to # return from a link embedded in the note. Else, reading more of the note # would require manual reopens. Info popups may not remain open on page # returns, but they have no embedded links to follow. # # See also the related popupLinksColor config for embedded links' color. # # Cautions: any stray "_<...>" or "_&...;" in a note is now interpreted as # an HTML tag or entity, and HTML syntax errors in tags are not handled # gracefully; preescape stray leading underscores with "__" as needed, # and code and test HTML components in notes carefully. For examples of # coding tags and entities, see examples/3.0-upgrades's *.note and NOTES.py. # # # The NOTES.py alternative: # # [3.0] Also as of 3.0, the NOTES.py file provides an optional and advanced # way to code notes. If present in the images folder, this file contains a # Python dictionary that associates any number of image filenames with note # text strings using syntax {'filename.xxx': 'note text', ...}. Use normal # Python rules to code multiline note text in this scheme: """, \, and '' '' # auto concatenation. # # Here is an example NOTES.py, indented for clarity (Python dictionaries use # syntax similar to JSON text): # # { # 'filename1.png': 'A simple single-line note.', # # 'filename2.jpg': # """ # A multiline and/or multiple paragraph note goes here. # # The _best_ book_you'll_ find at # _amazon_! # """, # # 'filename3.JPG': # 'A multiline note ' # 'with two emojis: 👍 _⭐ïļ', # } # # NOTES.py is an alternative to individual ".note" files but works the same # way, and augments and overrides any ".note" files also present in the images # folder. NOTES.py uses Unicode's UTF-8 encoding; all ASCII text qualifies. # # Notes always use case-sensitive matching of filenames on all build hosts. # To catch spelling and other mistakes, a "*CAUTION" is printed for both # ".note" files in the images folder and entries in the NOTES.py dictionary # that don't name a real image filename. #------------------------------------------------------------------------------- useImageNotes = True # True: show Note button and make up-swipe==Note, if "*.note" noteBoxVSpace = '15%' # space on left and right of popup: 15% leaves 70% for box # Plus noteEncoding .note Unicode setting earlier in this file # Plus popup* bg/fg/bd/opacity color settings earlier in this file #------------------------------------------------------------------------------- # Console-input overrides: via configs, here or in command-line args [2.3] #------------------------------------------------------------------------------- # The following settings correspond to inputs requested interactively at the # console in all prior releases. If any are not None, their value is used for # the input, and the input is not requested in the console. If None, their # values are asked as before. All are preset to None here, to ask by default. # # With 2.2, console inputs became arguably redundant with build-command config # arguments. The settings here allow inputs to be provided either here or in # "setting=value" config arguments in a backward-compatible fashion, and can # avoid some former "< '.' ('.', but uses arg #1 if passed) # inputCleanThumbsFolder => 'y' (True) # inputThumbsPerRow => '4' (4, required for fixed layout only) # inputThumbMaxSize => '(100, 100)' (100 or (100, 100)) # inputUseViewerPages => 'y' (True) #------------------------------------------------------------------------------- # None=ask, else use value and don't ask inputImagesFolderPath = None # string 'path' (used iff not first argument) inputCleanThumbsFolder = None # True or False inputThumbsPerRow = None # integer (used iff not useDynamicIndexLayout) inputThumbMaxSize = None # 2-tuple of ints, or int (inputThumbMaxSize=128) inputUseViewerPages = None # True or False (inputUseViewerPages=True) #------------------------------------------------------------------------------- # Thumbs-only index pages: don't show image filename labels? [2.3] #------------------------------------------------------------------------------- # If the following is True, the index page will display only thumbnail # images, not their filename labels. This might be useful when thumbs # alone are enough, or viewer-page Note popups provide ample description. # It also deviates from the folder-view paradigm, and deprives viewers of # potentially descriptive filenames. Your gallery mileage may vary. # # Note: this works for both fixed and dynamic index-page layouts, but # you'll probably want to also use dynamicLayoutPaddingH/V above in # dynamic layout, to spread thumbs out more than their defaults. # Fixed layout doesn't allow spacing to be tweaked, but automatically # sets it to accommodate its resizing table and avoid thumb collisions. # # [3.0] When the new CAPTIONS.py file's dictionary is used to override # filenames with general captions text (per ahead), omitIndexPageLabels # omits them on index pages only; they still appear on viewer pages. #------------------------------------------------------------------------------- omitIndexPageLabels = False # True=thumbnail images only, False=thumb+label # Plus dynamicLayoutPaddingH/V for dynamic-layout spacing (e.g., '16px') #------------------------------------------------------------------------------- # Viewer pages: denote start/end of gallery on navigation wraparounds? [3.0] #------------------------------------------------------------------------------- # 3.0 adds two ways to automatically denote end-of-gallery when navigating # forward from the last image or backward from the first image. These # navigations, called wraparounds, can occur during both Next/Prev manual # requests (including their swipe gestures) and Auto slideshows. For these: # # If useEndOfGalleryPage is True: # A simple "End of Gallery" page is added to the end of the gallery. # This page appears in both Auto slideshows and Next/Prev manual # navigations, but it does not appear on the index (thumbs) page. # # If useEndOfGalleryMessage is True: # A 2-second auto-closing message appears whenever moving to the # first or last image, during both Next/Prev manual navigations and # Auto slideshows. These messages never appear on index pages. # # One, both, or neither can be enabled by settings below. If neither is # True, both Next/Prev and Auto silently advance to the first/last image on # wraparounds. This is the prior behavior but may be subpar if users cannot # tell that they've wrapped around to the beginning or ending of the gallery. # # useEndOfGalleryPage below automates a technique some users were already # using, but useEndOfGalleryMessage may be preferred for galleries that # already have an obvious beginning or ending because it doesn't add a page. # # Note that [3.0] also shows a 2-second message on image clicks to announce # raw-view mode and instruct the user to tap Back to return to the gallery. # This is not configurable because it's always useful; else, users may not # realize that they've left the gallery due to an unintended image tap. #------------------------------------------------------------------------------- useEndOfGalleryPage = True # Add an "End of gallery" viewer page for wraparounds? useEndOfGalleryMessage = True # Show a 2-second message on Next/Prev/Auto wraparounds? #------------------------------------------------------------------------------- # Omit file extensions when filenames are used as image labels anywhere? [3.0] #------------------------------------------------------------------------------- # As of 3.0, setting the following to True allows you to omit filename # extensions (e.g., ".jpg", ".png") on both index and viewer pages when # filenames are used as image labels. This includes viewer-page HTML titles. # Dependency: if setting omitIndexPageLabels (above) is True, this setting has # no effect on the index page (image labels are then omitted in full), but # it still causes extensions to be omitted in viewer pages. # # Note that spaces and most other characters work in filenames too, so they # can serve as general image captions. This is subject to the filename-character # limits on the platforms that will host your gallery: for portability, your # filenames generally shouldn't contain any characters in [/ \ | < > ? * : "]. # Unix allows most characters except '/', but this varies per filesystem and OS. # # [3.0] The info popup in viewer pages (label tap or downswipe) now displays # the image's filename too. This is useful if extensions are omitted per the # setting below, but also if CAPTIONS.py is used per the following. # # # The CAPTIONS.py alternative: # # [3.0] For an optional and advanced way to provide image-label captions, use # 3.0's CAPTIONS.py file option. If present in the images folder, this file # contains a Python dictionary that associates any number of image filenames # with caption text strings using syntax {'filename.xxx': 'caption text', ...}. # Non-string values in this dictionary are automatically converted to strings, # and any newlines (\n) are ignored. Here is a basic CAPTIONS.py example # (Python dictionaries have syntax similar to JSON text): # # { # 'filename1.jpg': 'Building on Android \n is \n ðŸ˜ąðŸĪŠ?', # 'filename2.png': 'Anything goes: / \ | < > ? * : " 👏', # 'filename3.JPG': 63, # } # # Any captions coded in CAPTIONS.py override filenames and appear as labels on # both index and viewer pages. They may contain any Unicode text and are not # subject to platform character limits (see above). If caption text spans # multiple lines with """..."", its embedded newlines are ignored by browsers. # # Captions in CAPTIONS.py are not shortened by omitFilenameExtensions below, # but are omitted from index pages if config omitIndexPageLabels above is True. # CAPTIONS.py should be encoded (saved) per Unicode's general UTF-8 encoding; # all ASCII text and files automatically qualify. # # Captions always use case-sensitive matching of filenames on all build hosts. # To catch spelling and other mistakes, a "*CAUTION" is printed for entries # in the CAPTIONS.py dictionary that don't name a real image filename. #------------------------------------------------------------------------------- omitFilenameExtensions = True # Don't show filename extensions in image labels? #------------------------------------------------------------------------------- # Use template-autothemes.html's dark theme for index and viewer pages? [3.0] #------------------------------------------------------------------------------- # If useCannedDarkTheme is not False, the CSS style themes in this program's # template-autothemes.html are inserted into both index and viewer pages, # and a separate set of color configs are applied in dark mode. # # This is primarily meant to support a dark-mode theme that can be responsive # to settings on the host device, and overrides other color settings if used. # Please note that dark mode is provisional and somewhat experimental in 3.0, # and may not work with all index-page custom headers or footers. RFC. # # Set useCannedDarkTheme below to one of: # # - False to disable this feature in full # - 'host' to use dark theme only if dark mode is enabled on the host device # - 'always' to force the dark theme irrespective of the host device's mode # # If 'host', enabling and disabling dark mode on the host device will toggle # between dark theme and all other color configs in this file. # # This config is preset to 'host', which means enabling and disabling dark # display mode on the host device will toggle between dark theme and all # other color configs in this config file. # # Dark theme is part;y defined in file template-autothemes.html. Edit freely, # though its preset defaults can be accepted verbatim. This file's style # code is applied to both index and viewer pages, but as shipped, defines # only a dark theme, which is defined after a custom HEADER.html file but # before a FOOTER.html, so it overrides the former but not the latter. # # For always-light or always-dark themes, simply tailor the many color # settings in this file (or pass equivalent command-line arguments). The # new dark theme instead supports colorizations that are based on, and # respond to changes in, the host device's light/dark display mode. It's # somewhat at odds with this program's original color-settings model, and # viewer pages have always been dark to avoid clashing with images, but the # new template is required to override styles in custom index=page headers. # # Bonus: the darkTheme* configs below are applied in dark mode only and may # avoid mods to the dark template file. Among these, darkThemeLinksColor sets # the color of all viewer-page links per gallery without editing the template. # It colorizes both toolbar links on viewer pages and embedded tags in # Note text, and is preset to popupLinksColor, used for embedded s when # dark theme is off; change here override for dark only. The *PopupBgColors # apply to note, info, and message popups in dark theme only, and other colors # are dark-only counterparts to original colors defined earlier in this file. # # The new darkThemeIndex* here allow global colors without a custom header, # and this was not formerly available in the original (now light) model above. # It's been added in 3.0 to the orignal/light colors set above for parity, # though it applies only to default (not custom) headers in light mode. # In dark mode, index colors override any defined earlier in the index page; # in light, we shouldn't override colors given explicitly in a custom header. #------------------------------------------------------------------------------- useCannedDarkTheme = 'host' # False=no, 'host'=per host, 'always'=forced # (Dark only) index-page and viewer-page links darkThemeLinksColor = popupLinksColor # CSS color spec for all links in dark theme # (Dark only) viewer-page info, note, and message popups darkThemePopupBgColor = 'black' # background color for all popups in dark theme darkThemePopupFgColor = 'wheat' # foreground color for all popups in dark theme darkThemePopupBorderColor = 'white' # border color for all popups in dark theme # (Dark only) viewer page surface, text, borders darkThemeViewerBgColor = 'black' # viewer background color (black) darkThemeViewerFgColor = '#e0e0e0' # viewer foreground: label+buttons (off-white) darkThemeViewerBorderColor = darkThemeViewerFgColor # viewer fullsize image border # (Dark only) index page and its thumbs table darkThemeIndexBgColor = '#121212' # index page background color (off-black) darkThemeIndexFgColor = '#e0e0e0' # index page foreground color (off-white) darkThemeThumbsBgColor = '#242424' # thumbs table background color (grey) darkThemeThumbsFgColor = '#e0e0e0' # thumbs table foreground: filename (off-white) darkThemeThumbsBorderColor = darkThemeThumbsFgColor # thumbs table thumbnail image border #------------------------------------------------------------------------------- # Text line spacing: all index page, and viewer-page Info and Note popups [3.0] #------------------------------------------------------------------------------- # If the following is not None, its value is used to set line spacing for all # text in the index page (including text in custom HEADER.html files), as well # as Info and Note text in viewer pages. Any CSS size value may be used (e.g., # '1.3em', '150%', '24px') and is applied to the CSS line-height attribute. # A value of None (no quotes) uses host browsers' default spacing, as before. # # Extra line spacing may aid readability, especially in dark-mode themes, and # can make embedded links easier to tap on mobile devices and PC touch screens. #------------------------------------------------------------------------------- textLineSpacing = '1.25em' # None for browser default spacing, or '1.3em', etc. #------------------------------------------------------------------------------- # Enable swipes on touchpads and mousewheels (in addition to touchscreens) [3.0] #------------------------------------------------------------------------------- # As preset below, 3.0 viewer pages respond to left/right and up/down gestures on # touchpads and mousewheels to trigger Prev, Next, Note, and info. This is in # addition to the prior touchscreen gesture support. It's generally triggered # by a two-finger swipe on a capable touchpad or a mousewheel spin (which may be # a wheel tip, one-finger swipe on Apple "magic" mice, or other gesture). On # some devices, sensitivity may need to be scaled down for better responsiveness. # # Because the new support will prevent pad/wheel swipes from reaching the browser, # it can be turned off per gallery build by setting to False below. Though they # work, pad/wheel swipes are also laggy compared to touchscreens because they use # a mousewheel event that must be debounced until the wheel event stream is over. # # Tip: on PCs, use touchscreens (where available) or keypresses (up next) for # faster response than touchpad swipes or mousewheel spins. # # # The keypresses alternative: # # In addition to swipes and widget taps. viewer pages now respond to a # set of keyboard key presses. If a keyboard is present on the host # device, the keyboard keys on the left of "=>" in the following are # the same as tapping widgets in the right and automatically invoke # the action in parentheses: # # p => Prev (previous image) # n => Next (next image) # i => Index (return to index page) # t => Note (open image note) # a => Auto (toggle slideshow on/off) # f => Full (toggle fullscreen on/off) # ? => label (open image info) # . => image (open raw view) # Enter => OK (close an open dialog) # # There are no configs for this extension because it has no known downsides. # This raises the number of UI options for viewer pages to four: widget taps # or clicks, touch screen swipes, touchpad/mousewheel swipes, and keypresses. #------------------------------------------------------------------------------- doTouchpadMouseSwipes = True # False=disable to send swipes to browser # [end]