The Shulchan Aruch · Orach Chayim
אורח חיים רכ״טOrach Chayim 229
Siman 229 of 697 in Orach Chayim — 2 se'ifim
הלכות שאר ברכותLaws of Other Blessings· siman 229
Se’if 1א׳
הָרוֹאֶה הַקֶּשֶׁת, אוֹמֵר: בָּרוּךְ אַתָּה ה' אֱלֹהֵינוּ מֶלֶךְ הָעוֹלָם זוֹכֵר הַבְּרִית נֶאֱמָן בִּבְרִיתוֹ וְקַיָּם בְּמַאֲמָרוֹ; וְאָסוּר לְהִסְתַּכֵּל בּוֹ בְּיוֹתֵר.
One who sees the rainbow says, "Blessed are you, God our Lord, king of the world, who remembers the covenant, who is faithful to his covenant, and who fulfills his word." And it is forbidden to look upon it further.
Se’if 2ב׳
הָרוֹאֶה חַמָּה בִּתְקוּפָתָהּ, וְהוּא מִכ"ח לְכ"ח שָׁנָה, וְהַתְּקוּפָה בִּתְחִלַּת לֵיל ד', כְּשֶׁרוֹאֶה אוֹתָהּ בְּיוֹם ד' בַּבֹּקֶר, אוֹמֵר: בָּרוּךְ עוֹשֵׂה בְרֵאשִׁית; וְכֵן מְבָרֵךְ גַּם כֵּן כְּשֶׁרוֹאֶה לְבָנָה בְּטַהֲרָתָהּ, וְכוֹכָבִים בְּמִשְׁמְרוֹתָם, וּמַזָּלוֹת בְּעִתָּם, דְּהַיְנוּ כְּשֶׁתַּחֲזֹר הַלְּבָנָה בִּתְחִלַּת מַזַּל טָלֶה בִּתְחִלַּת הַחֹדֶשׁ, וְלֹא תִּהְיֶה נוֹטָה לֹא לַצָּפוֹן וְלֹא לַדָּרוֹם, וְכֵן כְּשֶׁיַּחְזְרוּ כָּל כּוֹכָב מֵחֲמִשָּׁה הַנִּשְׁאָרִים לִתְחִלַּת מַזַּל טָלֶה, וְלֹא יְהֵא נוֹטֶה לֹא לַצָּפוֹן וְלֹא לַדָּרוֹם, וְכֵן בְּכָל עֵת שֶׁיִּרְאֶה מַזַּל טָלֶה עוֹלֶה מִקְצוֹת הַמִּזְרָח.
One who sees the sun at its tekufah [cycle/season]—which occurs every 28 years, and the tekufah begins at the start of the night preceding Wednesday—when one sees it [the sun] on Wednesday morning, says: "Blessed... Who makes the works of creation." And similarly, one also makes this blessing when seeing the moon in its purity, the stars in their watches, and the constellations in their appointed times. This refers to when the moon returns to the beginning of the constellation Aries at the start of the [lunar] month and is not inclined either northward or southward; and similarly when each of the five [visible] planets returns to the beginning of the constellation Aries and is not inclined either northward or southward; and similarly, any time one sees the constellation Aries rising from the eastern edge [of the horizon].
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0