54d7b85bed
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
112 lines
3.0 KiB
Python
112 lines
3.0 KiB
Python
from pptx import Presentation
|
|
from pptx.util import Inches, Pt
|
|
from pptx.dml.color import RGBColor
|
|
from pptx.enum.text import PP_ALIGN
|
|
|
|
OUT_PATH = r"C:\Users\jhodgkin\Documents\dev\primary-song-slides\songs\anytime-anywhere\AnytimeAnywhere.pptx"
|
|
|
|
SLIDE_W = Inches(13.333)
|
|
SLIDE_H = Inches(7.5)
|
|
|
|
# Calm, prayerful palette: deep twilight blue background, soft gold accents
|
|
TWILIGHT = RGBColor(0x1C, 0x2E, 0x4A)
|
|
GOLD = RGBColor(0xE8, 0xC5, 0x6A)
|
|
WHITE = RGBColor(0xFF, 0xFF, 0xFF)
|
|
|
|
TITLE = "Anytime, Anywhere"
|
|
|
|
VERSES = [
|
|
(
|
|
"Verse 1",
|
|
"I can pray to my Heav'nly Father\n"
|
|
"Anytime, anywhere.\n"
|
|
"For He always cares,\n"
|
|
"And He hears my prayers—\n"
|
|
"Anytime, anywhere."
|
|
),
|
|
(
|
|
"Verse 2",
|
|
"I can listen for heav'nly guidance\n"
|
|
"Anytime, anywhere.\n"
|
|
"The Spirit will guide\n"
|
|
"As I seek His light—\n"
|
|
"Anytime, anywhere."
|
|
),
|
|
]
|
|
|
|
|
|
def set_background_color(slide, color):
|
|
fill = slide.background.fill
|
|
fill.solid()
|
|
fill.fore_color.rgb = color
|
|
|
|
|
|
def add_gold_rule(slide, top):
|
|
rule = slide.shapes.add_shape(
|
|
1, # rectangle
|
|
Inches(1.5), top, SLIDE_W - Inches(3.0), Inches(0.06)
|
|
)
|
|
rule.fill.solid()
|
|
rule.fill.fore_color.rgb = GOLD
|
|
rule.line.fill.background()
|
|
|
|
|
|
def add_slide(prs, blank_layout, verse_label, verse_text):
|
|
slide = prs.slides.add_slide(blank_layout)
|
|
set_background_color(slide, TWILIGHT)
|
|
|
|
add_gold_rule(slide, Inches(0.55))
|
|
|
|
# Song title
|
|
title_box = slide.shapes.add_textbox(Inches(0.5), Inches(0.65), SLIDE_W - Inches(1.0), Inches(0.85))
|
|
p = title_box.text_frame.paragraphs[0]
|
|
p.alignment = PP_ALIGN.CENTER
|
|
run = p.add_run()
|
|
run.text = TITLE
|
|
run.font.size = Pt(36)
|
|
run.font.color.rgb = GOLD
|
|
run.font.bold = True
|
|
|
|
# Verse label
|
|
label_box = slide.shapes.add_textbox(Inches(0.5), Inches(1.45), SLIDE_W - Inches(1.0), Inches(0.5))
|
|
p2 = label_box.text_frame.paragraphs[0]
|
|
p2.alignment = PP_ALIGN.CENTER
|
|
run2 = p2.add_run()
|
|
run2.text = verse_label
|
|
run2.font.size = Pt(22)
|
|
run2.font.color.rgb = WHITE
|
|
run2.font.italic = True
|
|
|
|
add_gold_rule(slide, Inches(1.95))
|
|
|
|
# Verse lyrics
|
|
lyric_box = slide.shapes.add_textbox(Inches(0.5), Inches(2.3), SLIDE_W - Inches(1.0), Inches(4.8))
|
|
tf = lyric_box.text_frame
|
|
tf.word_wrap = True
|
|
for i, line in enumerate(verse_text.split("\n")):
|
|
p = tf.paragraphs[0] if i == 0 else tf.add_paragraph()
|
|
p.alignment = PP_ALIGN.CENTER
|
|
run = p.add_run()
|
|
run.text = line
|
|
run.font.size = Pt(40)
|
|
run.font.color.rgb = WHITE
|
|
|
|
print(f" Added: {verse_label}")
|
|
|
|
|
|
def main():
|
|
prs = Presentation()
|
|
prs.slide_width = SLIDE_W
|
|
prs.slide_height = SLIDE_H
|
|
blank_layout = prs.slide_layouts[6]
|
|
|
|
for label, text in VERSES:
|
|
add_slide(prs, blank_layout, label, text)
|
|
|
|
prs.save(OUT_PATH)
|
|
print(f"\nSaved: {OUT_PATH} ({len(VERSES)} slides)")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|